public void Start() { if (AutoRotator == null) { AutoRotator = GetComponent <HingeAutoRotator>(); } }
public override void OnInspectorGUI() { if (targets.Length == 1) { HingeAutoRotator myScript = (HingeAutoRotator)target; Rigidbody2D connBody = myScript.joint == null ? null : myScript.joint.connectedBody; GUI.enabled = false; EditorGUILayout.ObjectField("Connected body", connBody, typeof(Rigidbody2D), true); GUI.enabled = true; } DrawDefaultInspector(); }