public static bool Prefix(ProFlareBatch __instance) { if (!Core.GameMod.VREnabled) { return(true); } if (__instance.helperTransform == null) { _ProFlareBatch_CreateHelperTransform_Method.Invoke(__instance, null); } __instance.mat = new Material((Shader)null); if (__instance.meshFilter == null) { __instance.meshFilter = __instance.GetComponent <MeshFilter>(); } if (__instance.meshFilter == null) { __instance.meshFilter = __instance.gameObject.AddComponent <MeshFilter>(); } __instance.meshRender = __instance.gameObject.GetComponent <MeshRenderer>(); if (__instance.meshRender == null) { __instance.meshRender = __instance.gameObject.AddComponent <MeshRenderer>(); } if (__instance.FlareCamera == null) { __instance.FlareCamera = __instance.transform.root.GetComponentInChildren <Camera>(); } __instance.meshRender.material = __instance.mat; _ProFlareBatch_SetupMeshes_Method.Invoke(__instance, null); __instance.dirty = true; return(false); }
static void CreateSetup() { GameObject rootGO = new GameObject("ProFlareSetup"); rootGO.layer = 8; GameObject cameraGO = new GameObject("ProFlareCamera"); cameraGO.layer = 8; Camera camera = cameraGO.AddComponent <Camera>(); cameraGO.transform.parent = rootGO.transform; camera.clearFlags = CameraClearFlags.Depth; camera.orthographic = true; camera.orthographicSize = 1; camera.farClipPlane = 2; camera.nearClipPlane = -2; camera.depth++; camera.cullingMask = 1 << 8; GameObject batchGO = new GameObject("ProFlareBatch"); batchGO.layer = 8; batchGO.transform.parent = cameraGO.transform; ProFlareBatch batch = batchGO.AddComponent <ProFlareBatch>(); batch.FlareCamera = camera; GameObject MainCameraGo = GameObject.FindWithTag("MainCamera"); if (MainCameraGo) { #if UNITY_5 batch.GameCamera = MainCameraGo.GetComponent <Camera>(); batch.GameCameraTrans = MainCameraGo.transform; #else batch.GameCamera = MainCameraGo.camera; batch.GameCameraTrans = MainCameraGo.transform; #endif } Selection.activeGameObject = batchGO; }
public static bool Prefix(ProFlareBatch __instance) { if (!Core.GameMod.VREnabled) { return(true); } __instance.mat = new Material((Shader)null); __instance.meshRender.material = __instance.mat; if (__instance._atlas && __instance._atlas.texture) { __instance.mat.mainTexture = __instance._atlas.texture; } return(false); }
static void CreateSetupOnExisting() { GameObject cameraGO = null; Camera camera = null; if (Selection.activeGameObject) { camera = Selection.activeGameObject.GetComponent <Camera>(); if (camera == null) { Debug.LogError("ProFlares - No Camera Selected"); return; } else { cameraGO = Selection.activeGameObject; } } else { Debug.LogError("ProFlares - Nothing Selected"); return; } Vector3 worldScale = cameraGO.transform.localScale; Transform parent = cameraGO.transform.parent; while (parent != null) { worldScale = Vector3.Scale(worldScale, parent.localScale); parent = parent.parent; } // Debug.LogError(worldScale.x + " " + worldScale.y + " " + worldScale.z); // Debug.LogError(1f/worldScale.x + " " + 1f/worldScale.y + " " + 1f/worldScale.z); int layerNumber = cameraGO.layer; GameObject batchGO = new GameObject("ProFlareBatch"); batchGO.layer = layerNumber; batchGO.transform.parent = cameraGO.transform; batchGO.transform.localPosition = Vector3.zero; batchGO.transform.localScale = new Vector3(1f / worldScale.x, 1f / worldScale.y, 1f / worldScale.z); ProFlareBatch batch = batchGO.AddComponent <ProFlareBatch>(); batch.FlareCamera = camera; batch.FlareCameraTrans = camera.transform; GameObject MainCameraGo = GameObject.FindWithTag("MainCamera"); if (MainCameraGo) { batch.GameCamera = MainCameraGo.camera; batch.GameCameraTrans = MainCameraGo.transform; } Selection.activeGameObject = batchGO; }
static void CreateSetupOnExistingGameCamera() { GameObject cameraGO = null; Camera camera = null; if (Selection.activeGameObject) { camera = Selection.activeGameObject.GetComponent <Camera>(); if (camera == null) { Debug.LogError("ProFlares - No Camera Selected"); return; } else { cameraGO = Selection.activeGameObject; } } else { Debug.LogError("ProFlares - Nothing Selected"); return; } // Vector3 worldScale = cameraGO.transform.localScale; // Transform parent = cameraGO.transform.parent; int layerNumber = cameraGO.layer; GameObject batchGO = new GameObject("ProFlareBatch"); batchGO.layer = layerNumber; batchGO.transform.parent = cameraGO.transform; batchGO.transform.localPosition = Vector3.zero; batchGO.transform.localRotation = Quaternion.identity; batchGO.transform.localScale = Vector3.one; ProFlareBatch batch = batchGO.AddComponent <ProFlareBatch>(); batch.FlareCamera = camera; batch.GameCamera = camera; batch.FlareCameraTrans = camera.transform; batch.mode = ProFlareBatch.Mode.SingleCamera; batch.SingleCamera_Mode = true; batch.zPos = 1; /* * GameObject MainCameraGo = GameObject.FindWithTag("MainCamera"); * * if(MainCameraGo){ * batch.GameCamera = MainCameraGo.camera; * batch.GameCameraTrans = MainCameraGo.transform; * }*/ Selection.activeGameObject = batchGO; }
public override void OnInspectorGUI() { GUIStyle title = FlareEditorHelper.TitleStyle(); FlareEditorHelper.DrawGuiDivider(); EditorGUILayout.LabelField("Pro Flare Batch :", title); GUILayout.Space(10f); _ProFlareBatch = target as ProFlareBatch; //base.DrawDefaultInspector(); _ProFlareBatch.debugMessages = EditorGUILayout.Toggle("Debug Messages", _ProFlareBatch.debugMessages); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Mode", GUILayout.MaxWidth(100)); ProFlareBatch.Mode _mode = (ProFlareBatch.Mode)EditorGUILayout.EnumPopup(_ProFlareBatch.mode); if (_mode != _ProFlareBatch.mode) { _ProFlareBatch.mode = _mode; switch (_mode) { case (ProFlareBatch.Mode.Standard): { _ProFlareBatch.SingleCamera_Mode = false; _ProFlareBatch.VR_Mode = false; } break; case (ProFlareBatch.Mode.SingleCamera): { _ProFlareBatch.SingleCamera_Mode = true; _ProFlareBatch.VR_Mode = false; } break; case (ProFlareBatch.Mode.VR): { _ProFlareBatch.SingleCamera_Mode = false; _ProFlareBatch.VR_Mode = true; } break; } Updated = true; } EditorGUILayout.EndHorizontal(); ProFlareAtlas _atlas = EditorGUILayout.ObjectField("Flare Atlas", _ProFlareBatch._atlas, typeof(ProFlareAtlas), false) as ProFlareAtlas; if (!_ProFlareBatch._atlas) { EditorGUILayout.HelpBox("Assign a Flare Atlas.", MessageType.Error, false); } Camera _camera = EditorGUILayout.ObjectField("Game Camera", _ProFlareBatch.GameCamera, typeof(Camera), true) as Camera; if (_camera != _ProFlareBatch.GameCamera) { Updated = true; _ProFlareBatch.GameCamera = _camera; if (_ProFlareBatch.GameCamera) { _ProFlareBatch.GameCameraTrans = _camera.transform; } } if (_ProFlareBatch.GameCamera == null) { EditorGUILayout.HelpBox("Assign Game Camera.", MessageType.Warning, false); } _ProFlareBatch.FlareCamera = EditorGUILayout.ObjectField("Flare Camera", _ProFlareBatch.FlareCamera, typeof(Camera), true) as Camera; Texture2D temp2D = null; if (_atlas != _ProFlareBatch._atlas) { if (_atlas == null) { _ProFlareBatch._atlas = null; } else if (_atlas.texture != null) { if (_ProFlareBatch.VR_Mode) { _ProFlareBatch.name = "ProFlareBatch_VR (" + _atlas.gameObject.name + ")"; } else { _ProFlareBatch.name = "ProFlareBatch (" + _atlas.gameObject.name + ")"; } _ProFlareBatch._atlas = _atlas; _ProFlareBatch.ForceRefresh(); Updated = true; _ProFlareBatch.mat.mainTexture = _ProFlareBatch._atlas.texture; _ProFlareBatch.dirty = true; ProFlare[] flares = GameObject.FindObjectsOfType(typeof(ProFlare)) as ProFlare[]; foreach (ProFlare flare in flares) { flare.ReInitialise(); } } else { Debug.LogError("ProFlares - Atlas missing texture, Atlas not assigned."); } } if (_ProFlareBatch.mode == ProFlareBatch.Mode.VR) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("VR Flare Depth"); _ProFlareBatch.VR_Depth = EditorGUILayout.Slider(_ProFlareBatch.VR_Depth, 0f, 1f); EditorGUILayout.EndHorizontal(); } if (_ProFlareBatch._atlas) { if (_ProFlareBatch.mat) { if (Application.isPlaying || (_ProFlareBatch.mat.mainTexture == null)) { if (_atlas.texture != null) { _ProFlareBatch.mat.mainTexture = _atlas.texture; } } } FlareEditorHelper.DrawGuiDivider(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Connected Flares :", title); if (GUILayout.Button("Force Refresh", GUILayout.MaxWidth(120))) { _ProFlareBatch.ForceRefresh(); ProFlare[] flares = GameObject.FindObjectsOfType(typeof(ProFlare)) as ProFlare[]; foreach (ProFlare flare in flares) { flare.ReInitialise(); } Updated = true; } EditorGUILayout.EndHorizontal(); GUILayout.Space(9f); // if(_ProFlareBatch.Flares.Count != ProFlareBatch.FlaresList.Count){ // } if (_ProFlareBatch.FlaresList.Count < 1) { EditorGUILayout.LabelField("No Connected flares"); } else { EditorGUILayout.LabelField(_ProFlareBatch.FlaresList.Count.ToString() + " Flares Connected"); if (_ProFlareBatch.FlaresList.Count < 10) { _ProFlareBatch.showAllConnectedFlares = EditorGUILayout.Toggle("Show All Connected Flares", _ProFlareBatch.showAllConnectedFlares); } for (int i = 0; i < _ProFlareBatch.FlaresList.Count; i++) { if (_ProFlareBatch.FlaresList[i].flare == null) { continue; } EditorGUILayout.BeginHorizontal(); if (_ProFlareBatch.FlaresList[i].occlusion == null) { continue; } if (!_ProFlareBatch.FlaresList[i].occlusion.occluded) { EditorGUILayout.LabelField((i + 1).ToString() + " - " + _ProFlareBatch.FlaresList[i].flare.gameObject.name + " - " + _ProFlareBatch.FlaresList[i].occlusion._CullingState.ToString()); } else { EditorGUILayout.LabelField((i + 1).ToString() + " - " + _ProFlareBatch.FlaresList[i].flare.gameObject.name + " - " + _ProFlareBatch.FlaresList[i].occlusion._CullingState.ToString() + " - " + occluded); } if (GUILayout.Button("Select", GUILayout.Width(60))) { Selection.activeGameObject = _ProFlareBatch.FlaresList[i].flare.gameObject; } EditorGUILayout.EndHorizontal(); if (i > 10) { if (!_ProFlareBatch.showAllConnectedFlares) { break; } } } } FlareEditorHelper.DrawGuiDivider(); EditorGUILayout.LabelField("Settings :", title); GUILayout.Space(9f); _ProFlareBatch.zPos = EditorGUILayout.FloatField("Z Position", _ProFlareBatch.zPos); FlareEditorHelper.DrawGuiDivider(); EditorGUILayout.LabelField("Optimizations :", title); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Use Flare Culling"); _ProFlareBatch.useCulling = EditorGUILayout.Toggle(_ProFlareBatch.useCulling); GUI.enabled = _ProFlareBatch.useCulling; EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Cull Flares After Seconds "); _ProFlareBatch.cullFlaresAfterTime = EditorGUILayout.IntField(_ProFlareBatch.cullFlaresAfterTime); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Cull Flares when can cull # Flares "); _ProFlareBatch.cullFlaresAfterCount = EditorGUILayout.IntField(_ProFlareBatch.cullFlaresAfterCount); EditorGUILayout.EndHorizontal(); GUI.enabled = true; GUILayout.Space(8f); EditorGUILayout.BeginVertical("box"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Use Brightness Culling"); _ProFlareBatch.useBrightnessThreshold = EditorGUILayout.Toggle(_ProFlareBatch.useBrightnessThreshold); EditorGUILayout.EndHorizontal(); GUI.enabled = _ProFlareBatch.useBrightnessThreshold; _ProFlareBatch.BrightnessThreshold = Mathf.Clamp(EditorGUILayout.IntField(" Minimum Brightness", _ProFlareBatch.BrightnessThreshold), 0, 255); GUI.enabled = true; EditorGUILayout.EndVertical(); if (Application.isPlaying) { GUI.enabled = false; } else { GUI.enabled = true; } FlareEditorHelper.DrawGuiDivider(); EditorGUILayout.LabelField("Debug :", title); GUILayout.Space(8f); EditorGUILayout.BeginVertical("box"); EditorGUILayout.LabelField("Flare Count : " + _ProFlareBatch.FlaresList.Count); EditorGUILayout.LabelField("Flare Elements : " + _ProFlareBatch.FlareElements.Count); //if(_ProFlareBatch.meshFilter){ // EditorGUILayout.LabelField("Triangle Count : " + (_ProFlareBatch.meshFilter.sharedMesh.triangles.Length/3).ToString()); // EditorGUILayout.LabelField("Vertex Count : " + _ProFlareBatch.meshFilter.sharedMesh.vertexCount.ToString()); //} EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Show Overdraw", GUILayout.MaxWidth(160)); //_ProFlareBatch.useBrightnessThreshold = EditorGUILayout.Toggle(_ProFlareBatch.useBrightnessThreshold); bool overdraw = EditorGUILayout.Toggle(_ProFlareBatch.overdrawDebug); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); if (overdraw != _ProFlareBatch.overdrawDebug) { _ProFlareBatch.overdrawDebug = overdraw; if (overdraw) { temp2D = new Texture2D(1, 16); temp2D.name = "[Generated] Debug"; temp2D.hideFlags = HideFlags.DontSave; for (int i = 0; i < 16; ++i) { temp2D.SetPixel(0, i, Color.white); } _ProFlareBatch.mat.mainTexture = temp2D; } else { if (_atlas.texture != null) { _ProFlareBatch.mat.mainTexture = _atlas.texture; } if (temp2D != null) { Destroy(temp2D); } } } FlareEditorHelper.DrawGuiDivider(); if (GUI.changed || Updated) { Updated = false; EditorUtility.SetDirty(target); } } }
public override void OnInspectorGUI () { GUIStyle title = FlareEditorHelper.TitleStyle(); FlareEditorHelper.DrawGuiDivider(); EditorGUILayout.LabelField("Pro Flare Batch :",title); GUILayout.Space(10f); _ProFlareBatch = target as ProFlareBatch; // base.DrawDefaultInspector(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Mode",GUILayout.MaxWidth(100)); ProFlareBatch.Mode _mode = (ProFlareBatch.Mode)EditorGUILayout.EnumPopup(_ProFlareBatch.mode); if(_mode != _ProFlareBatch.mode){ _ProFlareBatch.mode = _mode; switch(_mode){ case(ProFlareBatch.Mode.Standard):{ _ProFlareBatch.SingleCamera_Mode = false; _ProFlareBatch.VR_Mode = false; }break; case(ProFlareBatch.Mode.SingleCamera):{ _ProFlareBatch.SingleCamera_Mode = true; _ProFlareBatch.VR_Mode = false; }break; case(ProFlareBatch.Mode.VR):{ _ProFlareBatch.SingleCamera_Mode = false; _ProFlareBatch.VR_Mode = true; }break; } Updated = true; } EditorGUILayout.EndHorizontal(); ProFlareAtlas _atlas = EditorGUILayout.ObjectField("Flare Atlas", _ProFlareBatch._atlas, typeof(ProFlareAtlas), false) as ProFlareAtlas; if(!_ProFlareBatch._atlas){ EditorGUILayout.HelpBox("Assign a Flare Atlas.", MessageType.Error,false); } Camera _camera = EditorGUILayout.ObjectField("Game Camera", _ProFlareBatch.GameCamera, typeof(Camera), true) as Camera; if(_camera != _ProFlareBatch.GameCamera){ Updated = true; _ProFlareBatch.GameCamera = _camera; if(_ProFlareBatch.GameCamera) _ProFlareBatch.GameCameraTrans = _camera.transform; } if(_ProFlareBatch.GameCamera == null) EditorGUILayout.HelpBox("Assign Game Camera.", MessageType.Warning,false); _ProFlareBatch.FlareCamera = EditorGUILayout.ObjectField("Flare Camera", _ProFlareBatch.FlareCamera, typeof(Camera), true) as Camera; Texture2D temp2D = null; if (_atlas != _ProFlareBatch._atlas) { if(_atlas == null) _ProFlareBatch._atlas = null; else if(_atlas.texture != null){ if(_ProFlareBatch.VR_Mode) _ProFlareBatch.name = "ProFlareBatch_VR ("+_atlas.gameObject.name+")"; else _ProFlareBatch.name = "ProFlareBatch ("+_atlas.gameObject.name+")"; _ProFlareBatch._atlas = _atlas; _ProFlareBatch.ForceRefresh(); Updated = true; _ProFlareBatch.mat.mainTexture = _ProFlareBatch._atlas.texture; _ProFlareBatch.dirty = true; ProFlare[] flares = GameObject.FindObjectsOfType(typeof(ProFlare)) as ProFlare[]; foreach(ProFlare flare in flares){ flare.ReInitialise(); } }else{ Debug.LogError("ProFlares - Atlas missing texture, Atlas not assigned."); } } if(_ProFlareBatch.mode == ProFlareBatch.Mode.VR){ EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("VR Flare Depth"); _ProFlareBatch.VR_Depth = EditorGUILayout.Slider(_ProFlareBatch.VR_Depth,0f,1f); EditorGUILayout.EndHorizontal(); } if (_ProFlareBatch._atlas) { if(_ProFlareBatch.mat) if(Application.isPlaying || (_ProFlareBatch.mat.mainTexture == null)) if(_atlas.texture != null) _ProFlareBatch.mat.mainTexture = _atlas.texture; FlareEditorHelper.DrawGuiDivider(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Connected Flares :",title); if(GUILayout.Button("Force Refresh",GUILayout.MaxWidth(120))){ _ProFlareBatch.ForceRefresh(); ProFlare[] flares = GameObject.FindObjectsOfType(typeof(ProFlare)) as ProFlare[]; foreach(ProFlare flare in flares){ flare.ReInitialise(); } Updated = true; } EditorGUILayout.EndHorizontal(); GUILayout.Space(9f); if(_ProFlareBatch.Flares.Count != _ProFlareBatch.FlareOcclusionData.Length){ } if(_ProFlareBatch.Flares.Count < 1) EditorGUILayout.LabelField("No Connected flares"); else{ EditorGUILayout.LabelField(_ProFlareBatch.Flares.Count.ToString()+" Flares Connected"); if(_ProFlareBatch.Flares.Count < 10) _ProFlareBatch.showAllConnectedFlares = EditorGUILayout.Toggle("Show All Connected Flares",_ProFlareBatch.showAllConnectedFlares); for(int i = 0; i < _ProFlareBatch.Flares.Count; i++){ EditorGUILayout.BeginHorizontal(); if(_ProFlareBatch.FlareOcclusionData[i] == null) continue; if(!_ProFlareBatch.FlareOcclusionData[i].occluded) EditorGUILayout.LabelField((i+1).ToString()+" - "+_ProFlareBatch.Flares[i].gameObject.name+" - "+_ProFlareBatch.FlareOcclusionData[i]._CullingState.ToString()); else EditorGUILayout.LabelField((i+1).ToString()+" - "+_ProFlareBatch.Flares[i].gameObject.name+" - "+_ProFlareBatch.FlareOcclusionData[i]._CullingState.ToString()+" - "+occluded); if(GUILayout.Button("Select",GUILayout.Width(60))) { Selection.activeGameObject = _ProFlareBatch.Flares[i].gameObject; } EditorGUILayout.EndHorizontal(); if(i > 10){ if(!_ProFlareBatch.showAllConnectedFlares) break; } } } FlareEditorHelper.DrawGuiDivider(); EditorGUILayout.LabelField("Settings :",title); GUILayout.Space(9f); _ProFlareBatch.zPos = EditorGUILayout.FloatField("Z Position",_ProFlareBatch.zPos); FlareEditorHelper.DrawGuiDivider(); EditorGUILayout.LabelField("Optimizations :",title); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Use Flare Culling"); _ProFlareBatch.useCulling = EditorGUILayout.Toggle(_ProFlareBatch.useCulling); GUI.enabled = _ProFlareBatch.useCulling; EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Cull Flares After Seconds "); _ProFlareBatch.cullFlaresAfterTime = EditorGUILayout.IntField(_ProFlareBatch.cullFlaresAfterTime); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Cull Flares when can cull # Flares "); _ProFlareBatch.cullFlaresAfterCount = EditorGUILayout.IntField(_ProFlareBatch.cullFlaresAfterCount); EditorGUILayout.EndHorizontal(); GUI.enabled = true; GUILayout.Space(8f); EditorGUILayout.BeginVertical("box"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Use Brightness Culling"); _ProFlareBatch.useBrightnessThreshold = EditorGUILayout.Toggle(_ProFlareBatch.useBrightnessThreshold); EditorGUILayout.EndHorizontal(); GUI.enabled = _ProFlareBatch.useBrightnessThreshold; _ProFlareBatch.BrightnessThreshold = Mathf.Clamp(EditorGUILayout.IntField(" Minimum Brightness",_ProFlareBatch.BrightnessThreshold),0,255); GUI.enabled = true; EditorGUILayout.EndVertical(); if(Application.isPlaying) GUI.enabled = false; else GUI.enabled = true; FlareEditorHelper.DrawGuiDivider(); EditorGUILayout.LabelField("Debug :",title); GUILayout.Space(8f); EditorGUILayout.BeginVertical("box"); EditorGUILayout.LabelField("Flare Count : " + _ProFlareBatch.Flares.Count); EditorGUILayout.LabelField("Flare Elements : " + _ProFlareBatch.FlareElements.Count); //if(_ProFlareBatch.meshFilter){ // EditorGUILayout.LabelField("Triangle Count : " + (_ProFlareBatch.meshFilter.sharedMesh.triangles.Length/3).ToString()); // EditorGUILayout.LabelField("Vertex Count : " + _ProFlareBatch.meshFilter.sharedMesh.vertexCount.ToString()); //} EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Show Overdraw",GUILayout.MaxWidth(160)); //_ProFlareBatch.useBrightnessThreshold = EditorGUILayout.Toggle(_ProFlareBatch.useBrightnessThreshold); bool overdraw = EditorGUILayout.Toggle(_ProFlareBatch.overdrawDebug); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); if(overdraw != _ProFlareBatch.overdrawDebug){ _ProFlareBatch.overdrawDebug = overdraw; if(overdraw){ temp2D = new Texture2D(1, 16); temp2D.name = "[Generated] Debug"; temp2D.hideFlags = HideFlags.DontSave; for (int i = 0; i < 16; ++i) temp2D.SetPixel(0, i, Color.white); _ProFlareBatch.mat.mainTexture = temp2D; }else{ if(_atlas.texture != null) _ProFlareBatch.mat.mainTexture = _atlas.texture; if(temp2D != null) Destroy(temp2D); } } FlareEditorHelper.DrawGuiDivider(); if (GUI.changed||Updated) { Updated = false; EditorUtility.SetDirty (target); } } }