public static void PrepAssetForScreenSize(object asset) { GameObject gameObject = asset as GameObject; if (gameObject == null) { return; } GameObject gameObject2 = UnityUtils.FindGameObject(gameObject, "WidgetSafeArea"); if (gameObject2 == null) { return; } UIWidget component = gameObject2.GetComponent <UIWidget>(); Rect safeArea = SafeScreenUtils.GetSafeArea(); if (safeArea.width < (float)Screen.width || safeArea.height < (float)Screen.height || safeArea.x > 0f || safeArea.y > 0f) { if (SafeScreenUtils.useFixedAnchors) { component.leftAnchor.absolute = 53; component.topAnchor.absolute = 0; component.rightAnchor.absolute = -53; component.bottomAnchor.absolute = 0; } else { component.leftAnchor.absolute = (int)safeArea.x; component.topAnchor.absolute = (int)safeArea.y; component.rightAnchor.absolute = (int)(safeArea.width - (float)Screen.width); component.bottomAnchor.absolute = (int)(safeArea.height - (float)Screen.height); } } }
public static GameObject FindGameObject(GameObject parent, string name) { if (parent.name == name) { return(parent); } Transform transform = parent.transform; int i = 0; int childCount = transform.childCount; while (i < childCount) { GameObject gameObject = UnityUtils.FindGameObject(transform.GetChild(i).gameObject, name); if (gameObject != null) { return(gameObject); } i++; } return(null); }
public unsafe static long $Invoke19(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(UnityUtils.FindGameObject((GameObject)GCHandledObjects.GCHandleToObject(*args), Marshal.PtrToStringUni(*(IntPtr *)(args + 1))))); }