unity, get Canvas Scaler referenceResolution
需要using UnityEngine.UI;
然后就可以访问到CanvasScaler组件。
float width=GetComponent<CanvasScaler> ().referenceResolution.x
float height=GetComponent<CanvasScaler> ().referenceResolution.y
需要using UnityEngine.UI;
然后就可以访问到CanvasScaler组件。
float width=GetComponent<CanvasScaler> ().referenceResolution.x
float height=GetComponent<CanvasScaler> ().referenceResolution.y