private void OnEnable() { instance = target as GObjectSpawner; instance.Internal_UpdateFalloffTexture(); previewPropertyBlock = new MaterialPropertyBlock(); GCommon.RegisterBeginRender(OnCameraRender); GCommon.RegisterBeginRenderSRP(OnCameraRenderSRP); }
public override void OnInspectorGUI() { instance.SplineCreator = EditorGUILayout.ObjectField("Spline Creator", instance.SplineCreator, typeof(GSplineCreator), true) as GSplineCreator; if (instance.SplineCreator == null) { return; } bool wideMode = EditorGUIUtility.wideMode; EditorGUIUtility.wideMode = true; EditorGUI.BeginChangeCheck(); instance.Falloff = EditorGUILayout.CurveField("Falloff", instance.Falloff, Color.red, new Rect(0, 0, 1, 1)); if (EditorGUI.EndChangeCheck()) { instance.Internal_UpdateFalloffTexture(); } instance.FalloffNoise = GEditorCommon.InlineTexture2DField("Falloff Noise", instance.FalloffNoise); if (instance.FalloffNoise != null) { instance.FalloffNoiseSize = EditorGUILayout.Vector2Field("Falloff Noise Size", instance.FalloffNoiseSize); } instance.MaskResolution = EditorGUILayout.DelayedIntField("Mask Resolution", instance.MaskResolution); DrawObjectSelectorGUI(); instance.Density = EditorGUILayout.IntField("Density", instance.Density); instance.MinRotation = EditorGUILayout.FloatField("Min Rotation", instance.MinRotation); instance.MaxRotation = EditorGUILayout.FloatField("Max Rotation", instance.MaxRotation); instance.MinScale = GEditorCommon.InlineVector3Field("Min Scale", instance.MinScale); instance.MaxScale = GEditorCommon.InlineVector3Field("Max Scale", instance.MaxScale); instance.AlignToSurface = EditorGUILayout.Toggle("Align To Surface", instance.AlignToSurface); instance.Editor_ShowLivePreview = EditorGUILayout.Toggle("Live Preview", instance.Editor_ShowLivePreview); EditorGUIUtility.wideMode = wideMode; EditorGUILayout.Space(); if (GUILayout.Button("Apply")) { GAnalytics.Record(GAnalytics.SPLINE_OBJECT_SPAWNER); Apply(); } }