static public EditorUpdateHelper Self() { if (instance == null) { instance = new EditorUpdateHelper(); } return(instance); }
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); }
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); }