-
Notifications
You must be signed in to change notification settings - Fork 19
Version 2.6.0 Release Candidate instructions
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.
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.
Importing the AirConsole 2.6.0 RC1 unitypackage:
- Open
Assets > Import Package > Custom Package...
- Select
airconsole-unity-plugin-v2.6.0-rc1.unitypackage
in your downloads directory
We aim to automate all steps before the final release but for now please execute the following steps:
- Delete the Assets/AirConsole directory completely.
- If you don't need them, remove from
Plugins/Android
the following files: AndroidManifest.xml, all gradle files. - Import the RC1 package as described under
1.1 Importing the release candidate package
Please first follow Updating the Unity Plugin to a newer version
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.
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
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;
}
}
}
}
}