UnregisterLayoutChangedCallback(Action<DisplayLayoutChangedEventArgs>)
Removes a callback that was registered with DisplayInfo.RegisterLayoutChangedCallback.
Read time 1 minuteLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
public static bool UnregisterLayoutChangedCallback(Action<DisplayLayoutChangedEventArgs> callback)
Parameters
The callback to remove from the display layout changed notification list. If is null, Unity throws an .
callbackArgumentNullExceptionReturns
Type | Description |
|---|---|
| bool | true if the callback was registered and has been removed, otherwise false. |
Remarks
This method is supported only in Linux, Embedded Linux and QNX players. In the Editor and on other platforms it throws a .
NotSupportedExceptionExamples
using System.Collections.Generic;using UnityEngine;public class DisplayLayoutWatcher : MonoBehaviour{ private List<DisplayInfo> displays = new List<DisplayInfo>(); void OnEnable() { DisplayInfo.RegisterLayoutChangedCallback(OnDisplayLayoutChanged); } void OnDisable() { DisplayInfo.UnregisterLayoutChangedCallback(OnDisplayLayoutChanged); } void OnDisplayLayoutChanged(DisplayLayoutChangedEventArgs args) { DisplayInfo.GetLayout(displays); Debug.Log("Display layout changed. Display count: " + displays.Count); }}