public void InitUI2DCamera()
        {
            if (null != ui2DCamera)
            {
                return;
            }
            GameObject go = new GameObject("_UI2DCamera");

            Object.DontDestroyOnLoad(go);
            ui2DCamera                   = go.AddComponent <UICamera>();
            ui2DCamera.debug             = true;
            ui2DCamera.eventReceiverMask = CameraLayerManager.GetInstance().Get2DTag();

            camera = go.GetComponent <Camera>();
            if (camera == null)
            {
                camera = go.AddComponent <Camera>();
            }
            camera.orthographic     = true;
            camera.orthographicSize = 1;
            camera.nearClipPlane    = -10;
            camera.farClipPlane     = 3000;
            camera.depth            = 3;
            camera.clearFlags       = CameraClearFlags.Depth;
            camera.cullingMask      = CameraLayerManager.GetInstance().Get2DTag();
        }
Exemple #2
0
 public static CameraLayerManager GetInstance()
 {
     if (instance == null)
     {
         instance = new CameraLayerManager();
     }
     return(instance);
 }
 public void InitSceneCamera()
 {
     mainCamera             = Camera.main;
     mainCamera.cullingMask = CameraLayerManager.GetInstance().GetSceneTag();
 }