// Use this for initialization protected override void Awake() { transformCache = transform; base.Awake(); _incance = Instance = this; //Create ViewElementPool if (gameObject.name != viewSystemSaveData.globalSetting.ViewControllerObjectPath) { ViewSystemLog.LogWarning("The GameObject which attached ViewController is not match the setting in Base Setting."); } //Create UIRoot rootCanvasTransform = Instantiate(viewSystemSaveData.globalSetting.UIRoot).transform; rootCanvasTransform.SetParent(transformCache); rootCanvasTransform.localPosition = viewSystemSaveData.globalSetting.UIRoot.transform.localPosition; rootCanvasTransform.gameObject.name = viewSystemSaveData.globalSetting.UIRoot.name; var go = new GameObject("ViewElementPool"); go.transform.SetParent(transformCache); go.AddComponent <RectTransform>(); viewElementPool = go.AddComponent <ViewElementPool>();; runtimePool = gameObject.AddComponent <ViewElementRuntimePool>(); runtimePool.Init(viewElementPool); ViewElement.runtimePool = runtimePool; ViewElement.viewElementPool = viewElementPool; InjectionDictionary = new Dictionary <System.Type, Component>(); maxClampTime = viewSystemSaveData.globalSetting.MaxWaitingTime; minimumTimeInterval = viewSystemSaveData.globalSetting.minimumTimeInterval; try { breakPointsStatus = viewSystemSaveData.globalSetting.breakPoints.ToDictionary(m => m, m => false); } catch (Exception ex) { ViewSystemLog.LogError($"Error occur while proccess breakpoint {ex.Message}"); } }
void OnEnable() { runtimePool = (ViewElementRuntimePool)target; }