public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { SerializedProperty prefabProperty = property.FindPropertyRelative("prefab"); SerializedProperty sizeProperty = property.FindPropertyRelative("size"); SerializedProperty allowGrowthProperty = property.FindPropertyRelative("allowGrowth"); SerializedProperty useCustomRootProperty = property.FindPropertyRelative("useCustomRoot"); SerializedProperty rootProperty = property.FindPropertyRelative("m_Root"); SerializedProperty despawnModeProperty = property.FindPropertyRelative("mode"); SerializedProperty despawnPosProperty = property.FindPropertyRelative("despawnPos"); SerializedProperty audioSourceHandlingProperty = property.FindPropertyRelative("audioSourceHandling"); SerializedProperty particleSystemHandlingProperty = property.FindPropertyRelative("particleSystemHandling"); GameObject prefab = (GameObject)prefabProperty.objectReferenceValue; string prefabName = prefab != null ? prefab.name : "None"; despawnMode = (DespawnMode)despawnModeProperty.enumValueIndex; useCustomRoot = useCustomRootProperty.boolValue; //base.OnGUI(position, property, label); DrawHeader(position, prefabName, property); GUI.Box(position, "", GUI.skin.box); position.y += 5; if (property.isExpanded) { DrawField(position, prefabProperty, 1); DrawField(position, sizeProperty, 2); DrawField(position, allowGrowthProperty, 3); DrawEnumMaskField(position, audioSourceHandlingProperty, 4, "Audio Source"); DrawEnumMaskField(position, particleSystemHandlingProperty, 5, "Particle system"); DrawField(position, useCustomRootProperty, 6); if (useCustomRoot) { DrawField(position, rootProperty, 7); } DrawField(position, despawnModeProperty, useCustomRootProperty.boolValue ? 8 : 7); if (despawnMode == DespawnMode.Move) { DrawField(position, despawnPosProperty, useCustomRootProperty.boolValue ? 9 : 8); } } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { SerializedProperty prefabProperty = property.FindPropertyRelative("prefab"); SerializedProperty sizeProperty = property.FindPropertyRelative("size"); SerializedProperty allowGrowthProperty = property.FindPropertyRelative("allowGrowth"); SerializedProperty useCustomRootProperty = property.FindPropertyRelative("useCustomRoot"); SerializedProperty rootProperty = property.FindPropertyRelative("m_Root"); SerializedProperty despawnModeProperty = property.FindPropertyRelative("mode"); SerializedProperty despawnPosProperty = property.FindPropertyRelative("despawnPos"); SerializedProperty audioSourceHandlingProperty = property.FindPropertyRelative("audioSourceHandling"); SerializedProperty particleSystemHandlingProperty = property.FindPropertyRelative("particleSystemHandling"); GameObject prefab = (GameObject)prefabProperty.objectReferenceValue; string prefabName = prefab != null ? prefab.name : "None"; despawnMode = (DespawnMode)despawnModeProperty.enumValueIndex; useCustomRoot = useCustomRootProperty.boolValue; //base.OnGUI(position, property, label); DrawHeader(position, prefabName, property); GUI.Box(position, "", GUI.skin.box); position.y += 5; if (property.isExpanded) { DrawField(position, prefabProperty, 1); DrawField(position, sizeProperty, 2); DrawField(position, allowGrowthProperty, 3); DrawEnumMaskField(position, audioSourceHandlingProperty, 4, "Audio Source"); DrawEnumMaskField(position, particleSystemHandlingProperty, 5, "Particle system"); DrawField(position, useCustomRootProperty, 6); if (useCustomRoot) DrawField(position, rootProperty, 7); DrawField(position, despawnModeProperty, useCustomRootProperty.boolValue ? 8 : 7); if (despawnMode == DespawnMode.Move) DrawField(position, despawnPosProperty, useCustomRootProperty.boolValue ? 9 : 8); } }