Skip to content

Version 2.6.0 Release Candidate instructions

marc-n-dream edited this page May 7, 2025 · 5 revisions

Thank you, if you are participating in testing and finalizing the AirConsole Unity Plugin 2.6.0. Following are instructions as of 2.6.0 RC1.

1. Setting up in a new project

In this case, the only thing you need to do is download airconsole-unity-plugin-v2.6.0-rc1.unitypackage and import it (see 1.1). Afterwards please follow the normal instructions.

1.1 Importing the release candidate package

Importing the AirConsole 2.6.0 RC1 unitypackage:

  1. Open Assets > Import Package > Custom Package...
  2. Select airconsole-unity-plugin-v2.6.0-rc1.unitypackage in your downloads directory

2 Upgrading from AirConsole Plugin 2.5.x

2.1 Upgrading to 2.6.0 RC1

We aim to automate all steps before the final release but for now please execute the following steps:

  1. Delete the Assets/AirConsole directory completely.
  2. If you don't need them, remove from Plugins/Android the following files: AndroidManifest.xml, all gradle files.
  3. Import the RC1 package as described under 1.1 Importing the release candidate package

3 Upgrading from older AirConsole plugin versions

Please first follow Updating the Unity Plugin to a newer version

4 Important changes for Automotive

We implemented new features that Automotive Android games must use to work correctly and pass partner testing.

With version 2.6.0 the camera resizing has been replaced for Automotive. AirConsole now provides AirConsole.instance.OnSafeAreaChanged, an event which provides a safeArea in camera pixelRect coordinates. Automotive games are required to use this feature

To enable it, games need to enable the checkbox Native Game Sizing on the AirConsole component, rebuild the WebGL game and upload that new version.

image

To support you in the implementation and validation of your implementation, we added a new editor tool, called SafeArea Tester that you can find in the Unity Editor under Window/AirConsole/SafeArea Tester image

Using this, you can simulate different SafeAreas during Unity Editor PlayMode to identify problems early and address them easily and quickly.

Important: Games that use Android UI Resize Mode Resize Camera will have the main camera automatically adapted. If your game uses multiple cameras or splitscreen, you will want to make sure, that you set Android UI Resize Mode to No Resizing

Due to this change, the AndroidUIResizeMode.ResizeCameraAndReferenceResolution is no longer supported if Native Game Sizing is active.

Here is an example component showing the new SafeArea capabilities in the context of a UI camera that handles uniform resizing.

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using NDream.AirConsole;

[RequireComponent( typeof( Camera ) )]
public class CameraCanvasUpdater: MonoBehaviour
{
    [SerializeField] [AssignComponent] Camera m_camera;
    Canvas[] m_allSceneCanvases;
    CanvasScaler[] m_allSceneCanvasScalers;
    Vector2[] m_referenceResolutions;

    void Awake()
    {
        if (AirConsole.instance && AirConsole.instance.IsAirConsoleUnityPluginReady()) {
            HandleSafeAreaChanged(AirConsole.instance.SafeArea);
        } 
            
        var canvasObjects = GameObject.FindGameObjectsWithTag("Canvas");
        canvasObjects = canvasObjects.AllRemoved( x => x.RequestComponent< CanvasCameraAssignment >() != null );
        m_allSceneCanvases = canvasObjects.ConvertAll(x => x.RequireComponent<Canvas>());
        m_allSceneCanvasScalers = canvasObjects.ConvertAll(x => x.RequireComponent<CanvasScaler>());
        m_referenceResolutions = m_allSceneCanvasScalers.ConvertAll( x => x.referenceResolution );
        Camera.onPreRender += OnPreRenderCamera;

        for (int i = 0; i < m_allSceneCanvases.Length; ++i)
        {
            if( m_allSceneCanvases[i] != null )
            { 
                m_allSceneCanvases[i].worldCamera = m_camera;
            }
        }
        
        AirConsole.instance.OnSafeAreaChanged += HandleSafeAreaChanged;

        Canvas[] canvases = FindObjectsOfType<Canvas>();
        for (int i = 0; i < canvases.Length; ++i)
        {
            AssignCanvasToCamera( canvases[i], "Canvas" );
        }
    }
    
    private void AssignCanvasToCamera( Canvas _canvas, string filterTag )
    {
        if (_canvas.CompareTag(filterTag)) {
            _canvas.worldCamera = m_camera;
        }
    }

    private void HandleSafeAreaChanged(Rect newSafeArea) {
        m_camera.pixelRect = newSafeArea; 
    }

    void OnDestroy()
    {
        Camera.onPreRender -= OnPreRenderCamera;

        //restore the old aspect ratio
        for (int i = 0; i < m_allSceneCanvases.Length; ++i)
        {
            m_allSceneCanvasScalers[i].referenceResolution = m_referenceResolutions[ i ];
        }

        if (AirConsole.instance) {
            AirConsole.instance.OnSafeAreaChanged -= HandleSafeAreaChanged;
        }
    }

    void OnPreRenderCamera( Camera _camera )
    {
        if (_camera == m_camera)
        {
            for (int i = 0; i < m_allSceneCanvases.Length; ++i)
            {
                if( m_allSceneCanvases[i] != null )
                { 
                    m_allSceneCanvases[i].worldCamera = m_camera;
                    Vector2 actualReferenceResolution =  m_referenceResolutions[ i ].DividedBy( m_camera.rect.size );
                    m_allSceneCanvasScalers[i].referenceResolution = actualReferenceResolution;
                }
                
            }
        }
    }
	
}