private void Awake() { //得到UI根节点对象、脚本节点对象 _GoCanvasRoot = GameObject.FindGameObjectWithTag(SysDefine.SYS_TAG_CANVAS); _TraUIScriptsNode = UnityHelper.FindTheChildNode(_GoCanvasRoot, SysDefine.SYS_SCRIPTMANAGER_NODE); //把本脚本实例,作为“脚本节点对象”的子节点 UnityHelper.AddChildNodeToParentNode(_TraUIScriptsNode, this.gameObject.transform); _GoTopPanel = _GoCanvasRoot; _GoMaskPanel = UnityHelper.FindTheChildNode(_GoCanvasRoot, "_UIMaskPanel").gameObject; _UICamera = GameObject.FindGameObjectWithTag(SysDefine.SYS_TAG_UICAMERA).GetComponent <Camera>(); if (_UICamera != null) { _OriginalUICameraDepth = _UICamera.depth; } else { Debug.Log(GetType() + "/start()/UICamera is null"); } }
void Awake() { //得到UI根节点对象、脚本节点对象 _GoCanvasRoot = UIManager.Instance.canvas;//GameObject.FindGameObjectWithTag(SysDefine.SYS_TAG_CANVAS); _TraUIScriptsNode = UnityHelper.FindTheChildNode(_GoCanvasRoot, SysDefine.SYS_SCRIPTMANAGER_NODE); //把本脚本实例,作为“脚本节点对象”的子节点。 UnityHelper.AddChildNodeToParentNode(_TraUIScriptsNode, this.gameObject.transform); //得到“顶层面板”、“遮罩面板” _GoTopPanel = _GoCanvasRoot; _GoMaskPanel = UnityHelper.FindTheChildNode(_GoCanvasRoot, "_UIMaskPanel").gameObject; if (_UICamera != null) { //得到UI摄像机原始“层深” _OriginalUICameralDepth = _UICamera.depth; } else { Debug.Log(GetType() + "/Start()/UI_Camera is Null!,Please Check! "); } }
private void Awake() { //得到UI根节点和UI脚本节点对象 _GoCanvasRoot = GameObject.FindGameObjectWithTag(SysDefine.TAG_Canvas); _TraUIScriptsNode = UnityHelper.FindChildNode(_GoCanvasRoot, SysDefine.NODE_UIScripts); //把本脚本实例,作为“脚本节点对象”的子节点。 UnityHelper.AddChildNodeToParentNode(_TraUIScriptsNode, gameObject.transform); //得到顶层面板和遮罩面板 _GoTopPanel = _GoCanvasRoot; _GoUIMaskPanel = UnityHelper.FindChildNode(_GoCanvasRoot, SysDefine.GO_UIMaskPanel).gameObject; //得到UI摄像机以及原始层深 _UICamera = GameObject.FindGameObjectWithTag(SysDefine.TAG_UICamera).GetComponent <Camera>(); if (_UICamera != null) { _OriginalUICameraDepth = _UICamera.depth; } else { Debug.LogWarning("UI摄像机为空!"); } }