Пример #1
0
    private void ClearCameraAndRenderTexture()
    {
        texture = null;

        //if (_ModelT != null)
        //{
        //    _ModelT.SetParent(null, false);
        //    //Common.HobaDebuger.LogWarning("Remember to Realse the Model loaded! " + _ModelT.name);

        //    Debug.LogWarning("IMageModel Release Model 1");
        //    LuaScriptMgr.Instance.CallOnTraceBack();
        //    _ModelT = null;
        //}

        CleanPP();

        //if (_UICamera != null && _UICamera.targetTexture == _RenderTexture)
        //    _UICamera.targetTexture = null;

        //if (_RenderTexture != null)
        //{
        //    if (_RenderTexturePool != null)
        //        _RenderTexturePool.Pool(_RenderTexture);
        //    else
        //        DestroyImmediate(_RenderTexture);

        //    _RenderTexture = null;
        //}

        if (_IMRootT != null)
        {
            if (_PlatformT != null)
            {
                while (_PlatformT.childCount > 0)
                {
                    Transform t = _PlatformT.GetChild(0);
                    t.SetParent(null, false);
#if UNITY_EDITOR
                    Debug.LogError("Leaked model found in " + this.name);
                    LuaScriptMgr.Instance.CallOnTraceBack();
#endif
                }
            }

            _IMRootT.gameObject.SetActive(false);

            if (_CameraPool != null)
            {
                _CameraPool.Pool(_IMRootT.gameObject);
            }
            else
            {
                Destroy(_IMRootT.gameObject);
            }

            _IMRootT      = null;
            _UICamera     = null;
            _UICameraT    = null;
            _GroundT      = null;
            _StageT       = null;
            _PlatformT    = null;
            _GroundShadow = null;
            _GroundWater  = null;
        }

        if (_ID != -1)
        {
            _ActiveCameras[_ID] = null;
            _ID = -1;
        }
    }