/// <summary> /// Controls behavior of the inspector. /// </summary> public override void OnInspectorGUI() { CrowdAvoidanceSet targ = (CrowdAvoidanceSet)target; EditorGUIUtility.LookLikeControls(150); for (int i = 0; i < CrowdManager.MaxAvoidanceParams; i++) { //bool changed = GUI.changed; mDisplay[i] = EditorGUILayout.Foldout(mDisplay[i], mNames[i]); //GUI.changed = changed; if (mDisplay[i]) { CrowdAvoidanceParams config = targ[i]; float fv; fv = EditorGUILayout.FloatField("Velocity Bias", config.velocityBias); config.velocityBias = Mathf.Max(0, fv); fv = EditorGUILayout.FloatField( "Desired Velocity Weight", config.weightDesiredVelocity); config.weightDesiredVelocity = Mathf.Max(0, fv); fv = EditorGUILayout.FloatField( "Current Velocity Weight", config.weightCurrentVelocity); config.weightCurrentVelocity = Mathf.Max(0, fv); fv = EditorGUILayout.FloatField("Side Weight", config.weightSide); config.weightSide = Mathf.Max(0, fv); fv = EditorGUILayout.FloatField("TOI Weight", config.weightToi); config.weightToi = Mathf.Max(0, fv); fv = EditorGUILayout.FloatField("Horizontal Time", config.horizontalTime); config.horizontalTime = Mathf.Max(0, fv); int bv; bv = EditorGUILayout.IntField("Grid Size", config.gridSize); config.gridSize = (byte)Mathf.Clamp(bv, 0, byte.MaxValue); bv = EditorGUILayout.IntField("Adaptive Divisions", config.adaptiveDivisions); config.adaptiveDivisions = (byte)Mathf.Clamp(bv, 0, byte.MaxValue); bv = (byte)EditorGUILayout.IntField("Adaptive Rings", config.adaptiveRings); config.adaptiveRings = (byte)Mathf.Clamp(bv, 0, byte.MaxValue); bv = (byte)EditorGUILayout.IntField("Adaptive Depth", config.adaptiveDepth); config.adaptiveDepth = (byte)Mathf.Clamp(bv, 0, byte.MaxValue); } } EditorGUILayout.Separator(); if (GUI.changed) { EditorUtility.SetDirty(target); } }
static void EditSettings() { CrowdAvoidanceSet item = EditorUtil.GetGlobalAsset <CrowdAvoidanceSet>(); Selection.activeObject = item; }