public override void OnInspectorGUI() { GUI.changed = false; DrawDefaultInspector(); sc.rotation = EditorGUILayout.IntSlider("Rotation", sc.rotation, 0, 360 / sc.points); sc.advanced = EditorGUILayout.Toggle("Advanced", sc.advanced); if (sc.advanced) { sc.radiusA = EditorGUILayout.FloatField("RadiusA", sc.radiusA); sc.radiusB = EditorGUILayout.FloatField("RadiusB", sc.radiusB); } else { sc.radiusA = EditorGUILayout.Slider("RadiusA", sc.radiusA, 1, 25); sc.radiusB = EditorGUILayout.Slider("RadiusB", sc.radiusB, 1, 25); } if (GUI.changed || !off.Equals(polyCollider.offset)) { polyCollider.points = sc.getPoints(); } off = polyCollider.offset; }
void OnEnable() { sc = (StarCollider2D)target; edgeCollider = sc.GetComponent<EdgeCollider2D>(); if (edgeCollider == null) { sc.gameObject.AddComponent<EdgeCollider2D>(); edgeCollider = sc.GetComponent<EdgeCollider2D>(); } edgeCollider.points = sc.getPoints(edgeCollider.offset); }
void OnEnable() { sc = (StarCollider2D)target; polyCollider = sc.GetComponent <PolygonCollider2D>(); if (polyCollider == null) { polyCollider = sc.gameObject.AddComponent <PolygonCollider2D>(); } polyCollider.points = sc.getPoints(); }
void OnEnable() { sc = (StarCollider2D)target; edgeCollider = sc.GetComponent <EdgeCollider2D>(); if (edgeCollider == null) { sc.gameObject.AddComponent <EdgeCollider2D>(); edgeCollider = sc.GetComponent <EdgeCollider2D>(); } edgeCollider.points = sc.getPoints(edgeCollider.offset); }
public override void OnInspectorGUI() { GUI.changed = false; DrawDefaultInspector(); sc.rotation = EditorGUILayout.IntSlider("Rotation", sc.rotation, 0, 360 / sc.points); if (GUI.changed || !off.Equals(edgeCollider.offset)) { edgeCollider.points = sc.getPoints(edgeCollider.offset); } off = edgeCollider.offset; }