void CreateCanvas(eDispSort Idx) { if (m_EventSystem == null) { CreateEventSystem(); } GameObject Obj = new GameObject("Canvas" + CanvasName[(int)Idx]); Obj.transform.parent = transform; Canvas c = Obj.AddComponent <Canvas>(); c.renderMode = RenderMode.ScreenSpaceOverlay; c.sortingOrder = 1000 - ((int)Idx * 100); // Canvasのスケール調整に必要 CanvasScaler Scaler = Obj.AddComponent <CanvasScaler>(); Scaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize; Scaler.referenceResolution = new Vector2(BaseResolution.x, BaseResolution.y); Scaler.screenMatchMode = CanvasScaler.ScreenMatchMode.MatchWidthOrHeight; Scaler.matchWidthOrHeight = 0; Scaler.referencePixelsPerUnit = 100; // Canvas以下のオブジェクトのタッチに必要 Obj.AddComponent <GraphicRaycaster>(); m_Canvas[(int)Idx] = c; }
public GameObject CreateDispObj(GameObject Prefab, eDispSort DispZ) { GameObject Obj = null; Obj = Instantiate(Prefab); Obj.transform.SetParent(m_Canvas[(int)DispZ].transform, false); return(Obj); }
public void SceneChange( ) { for (eDispSort i = eDispSort.CommonMax; i < CanvasMgr.eDispSort.Max; i++) { Transform DispSortTrans = m_Canvas[(int)i].transform; foreach (Transform child in DispSortTrans) { Destroy(child.gameObject); } } }
protected override void Awake() { base.Awake(); if (CanvasMgr.Instance != this) { return; } m_Canvas = new Canvas[(int)CanvasMgr.eDispSort.Max]; for (eDispSort i = 0; i < CanvasMgr.eDispSort.Max; i++) { CreateCanvas(i); } s_CanvasBaseRectTransform = m_Canvas[0].GetComponent <RectTransform>(); //Debug.Log( m_Canvas[0]. ); //Debug.Log( ); CreateScreenFader(); }
public void EntryDispObj(GameObject Obj, eDispSort DispZ) { Obj.transform.SetParent(m_Canvas[(int)DispZ].transform, false); }