public override void OnInspectorGUI() { DrawDefaultInspector(); platform = target as PlatformBuilder; if (GUILayout.Button("Build")) { platform.Build(); } if (GUILayout.Button("Clear")) { platform.Clear(); } if (GUILayout.Button("Create New Platform on End")) { GameObject newPlatform = Object.Instantiate(platform.gameObject, platform.transform.parent); newPlatform.transform.position = platform.GetEndPoint(); PlatformBuilder pb = newPlatform.GetComponent <PlatformBuilder>(); pb.Clear(); pb.length = 5f; Selection.activeGameObject = newPlatform; } }