示例#1
0
        static public EditorUpdateHelper Self()
        {
            if (instance == null)
            {
                instance = new EditorUpdateHelper();
            }

            return(instance);
        }
示例#2
0
        public static int GetCurrentFrameCount()
        {
            int frame = 0;

            if (Application.isEditor && !Application.isPlaying)
            {
#if UNITY_EDITOR
                frame = EditorUpdateHelper.Self().updateTick;
#endif
            }
            else
            {
                frame = Time.frameCount;
            }

            return(frame);
        }
示例#3
0
        public static bool IsSceneViewCamera(Camera cam, bool forceUpdate = false)
        {
            // Added so InternalEditorUtility.GetSceneViewCameras() is not being called
            // Every Editor tick. This function is quite expensive and can generate a
            // lot of garbage. So to ensure a smooth editor experience we defer the update
            if (internalCameras == null ||
                lastUpdateTick != EditorUpdateHelper.Self().updateTick ||
                forceUpdate)
            {
                lastUpdateTick = EditorUpdateHelper.Self().updateTick;

                internalCameras = InternalEditorUtility.GetSceneViewCameras();
            }

            for (int i = 0; i < internalCameras.Length; i++)
            {
                if (internalCameras[i] == cam)
                {
                    return(true);
                }
            }

            return(false);
        }