static void CreateBridge(int length) { GameObject g = Resources.Load <GameObject>("Bridge Builder"); BridgeBuilder b = Instantiate(g).GetComponent <BridgeBuilder>(); b.length = length; b.BuildObject(); DestroyImmediate(b.gameObject); }
public override void OnInspectorGUI() { DrawDefaultInspector(); BridgeBuilder bridgeBuilder = (BridgeBuilder)target; if (GUILayout.Button("Build Object")) { bridgeBuilder.BuildObject(); } }