public void SetTarget() { EditorGUILayout.Separator(); EditorGUILayout.LabelField("[Target Select Helper]", EditorStyles.boldLabel); lookupObject = EditorGUILayout.ObjectField(lookupObject, typeof(GameObject), allowSceneObjects: true) as GameObject; if (lookupObject != null && PrefabHelper.IsPrefab(lookupObject)) { lookupObject = null; Debug.Log("Prefab is not allowed. Please select only the GameObject in the scene."); } if (lookupObject) { using (new EditorGUILayout.HorizontalScope()) { bIncludeChild = EditorGUILayout.ToggleLeft("Include Child", bIncludeChild); if (GUILayout.Button("Add")) { light.AddTarget(lookupObject, bIncludeChild); } if (GUILayout.Button("Remove")) { light.RemoveTarget(lookupObject, bIncludeChild); } } } EditorGUILayout.Separator(); layerMask = CustomEditorGUI.LayerMaskField("Layer Mask for Add/Remove", layerMask); GUILayoutOption halfWidth = GUILayout.Width(EditorGUIUtility.currentViewWidth * 0.5f); using (new EditorGUILayout.HorizontalScope()) { using (new EditorGUI.DisabledGroupScope(layerMask == 0)) { if (GUILayout.Button("Add all Masked Iso2DBase", halfWidth)) { light.AddTarget_All(layerMask); } if (GUILayout.Button("Clear all Masked layer", halfWidth)) { light.RemoveTarget_All(layerMask); } } } EditorGUILayout.Separator(); using (new EditorGUILayout.HorizontalScope()) { if (GUILayout.Button("Add all Iso2DBase", halfWidth)) { light.AddTarget_All(layerMask); } if (GUILayout.Button("Clear TargetList", halfWidth)) { light.RemoveTarget_All(); } } }
void OnGUI() { if (UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode) { GUILayout.Label("Not available in Play mode!", EditorStyles.boldLabel); return; } GUILayout.Label(HelpMSG_00, EditorStyles.boldLabel); GUILayout.Space(4); EditorGUILayout.HelpBox(HelpMSG_01, MessageType.Info); CustomEditorGUI.DrawSeperator(); origin = EditorGUILayout.ObjectField(new GUIContent("Source", "Root of Sources"), origin, typeof(GameObject), allowSceneObjects: true) as GameObject; CustomEditorGUI.DrawSeperator(); if (bFoldoutComponentList = EditorGUILayout.Foldout(bFoldoutComponentList, string.Format("The remaining components({0})", FilteredComponent.Count))) { var enumerator = FilterableComponent.GetEnumerator(); EditorGUI.indentLevel++; while (enumerator.MoveNext()) { var current = enumerator.Current; using (new EditorGUI.DisabledGroupScope(!current.Value)) { bool bFiltered = FilteredComponent.Contains(current.Key); EditorGUI.BeginChangeCheck(); bool bToggle = EditorGUILayout.ToggleLeft(current.Key.ToString(), bFiltered); if (EditorGUI.EndChangeCheck()) { if (bToggle && !bFiltered) { FilteredComponent.Add(current.Key); } else if (bFiltered) { FilteredComponent.Remove(current.Key); } } } } EditorGUI.indentLevel--; } if (isForNavMesh) { EditorGUI.indentLevel += 2; layerMask = CustomEditorGUI.LayerMaskField("LayerMask", layerMask); EditorGUI.indentLevel -= 2; } if (isRemovableState) { bRemoveAll = EditorGUILayout.ToggleLeft("Remove All(except for Nav Mesh)", bRemoveAll); } using (new EditorGUI.DisabledGroupScope(!origin)) { if (GUILayout.Button("Bake!", GUILayout.Height(30))) { Bake(); } } if (CustomEditorGUI.DestroyOBJBtn(baked, "Baked", GUILayout.Height(30))) { baked = null; } }