public override void OnInspectorGUI() { InteractionObjectData myTarget = (InteractionObjectData)target; myTarget.myObject = (InteractionObject)CustomGUILayout.ObjectField <InteractionObject>("Object:", myTarget.myObject, true); if (myTarget.myObject == null) { GUILayout.Label("Please choose an Interaction Object to continue."); return; } else { myTarget.myObject.interactionConstantID = ObjectFieldToID(myTarget.myObject.interactionObject, myTarget.myObject.interactionConstantID); myTarget.myObject.interactionObject = ObjectIDToField(myTarget.myObject.interactionObject, myTarget.myObject.interactionConstantID); EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); GUILayout.BeginVertical("Box"); GUILayout.Label(myTarget.myObject.objectName, EditorStyles.boldLabel); EditorGUILayout.ObjectField("Parent Object:", myTarget.myObject.objectParent, typeof(Transform), true); EditorGUILayout.ObjectField("Right Hold Position:", myTarget.myObject.rHandPosition, typeof(Transform), true); EditorGUILayout.ObjectField("Left Hold Position:", myTarget.myObject.lHandPosition, typeof(Transform), true); EditorGUILayout.ObjectField("Drop Position:", myTarget.myObject.dropPosition, typeof(Transform), true); EditorGUILayout.ObjectField("Right Target:", myTarget.myObject.rHandTarget, typeof(Transform), true); EditorGUILayout.ObjectField("Left Target:", myTarget.myObject.lHandTarget, typeof(Transform), true); EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); GUILayout.Label("Sound FX", EditorStyles.boldLabel); EditorGUILayout.ObjectField("Pick Up Sound:", myTarget.myObject.pickUpSound, typeof(AudioClip), true); EditorGUILayout.ObjectField("Drop Sound:", myTarget.myObject.dropSound, typeof(AudioClip), true); EditorGUILayout.ObjectField("Interaction Sound:", myTarget.myObject.interactSound, typeof(AudioClip), true); EditorGUILayout.ObjectField("Inventory Sound:", myTarget.myObject.inventorySound, typeof(AudioClip), true); GUILayout.Label("Inventory Properties", EditorStyles.boldLabel); if (myTarget.myObject.isInventoryItem) { GUILayout.Label("This is an inventory item.", EditorStyles.miniBoldLabel); GUILayout.Label("Inventory Item: " + AC.KickStarter.inventoryManager.items[myTarget.myObject.invID].label, EditorStyles.miniBoldLabel); EditorGUILayout.ObjectField("Prefab Reference:", AC.KickStarter.inventoryManager.items[myTarget.myObject.invID].linkedPrefab, typeof(GameObject), true); } else { GUILayout.Label("This is not an inventory item.", EditorStyles.miniBoldLabel); } GUILayout.EndVertical(); } }
public override void OnInspectorGUI() { InteractionObject myTarget = (InteractionObject)target; GUILayout.Label("Interaction Object Setup", EditorStyles.largeLabel); myTarget.objectParent = (Transform)CustomGUILayout.ObjectField <Transform>("Object Parent:", myTarget.objectParent, true); myTarget.interactionObject = (GameObject)CustomGUILayout.ObjectField <GameObject>("Object:", myTarget.interactionObject, true); if (myTarget.interactionObject) { GUILayout.Label("Object Name", EditorStyles.boldLabel); myTarget.objectName = EditorGUILayout.TextField(myTarget.objectName); GUILayout.Label("Object Hand Positions", EditorStyles.boldLabel); myTarget.rHandPosition = EditorGUILayout.ObjectField("Right Hand Position:", myTarget.rHandPosition, typeof(Transform), true) as Transform; myTarget.lHandPosition = EditorGUILayout.ObjectField("Left Hand Position:", myTarget.lHandPosition, typeof(Transform), true) as Transform; myTarget.dropPosition = EditorGUILayout.ObjectField("Drop Position:", myTarget.dropPosition, typeof(Transform), true) as Transform; GUILayout.Label("Object Targets", EditorStyles.boldLabel); myTarget.rHandTarget = EditorGUILayout.ObjectField("Right Hand Target:", myTarget.rHandTarget, typeof(Transform), true) as Transform; myTarget.lHandTarget = EditorGUILayout.ObjectField("Left Hand Position:", myTarget.lHandTarget, typeof(Transform), true) as Transform; GUILayout.Label("Object Sound FX", EditorStyles.boldLabel); myTarget.pickUpSound = EditorGUILayout.ObjectField("PickUp Sound:", myTarget.pickUpSound, typeof(AudioClip), false) as AudioClip; myTarget.dropSound = EditorGUILayout.ObjectField("Drop Sound:", myTarget.dropSound, typeof(AudioClip), false) as AudioClip; myTarget.interactSound = EditorGUILayout.ObjectField("Interact Sound:", myTarget.interactSound, typeof(AudioClip), false) as AudioClip; myTarget.inventorySound = EditorGUILayout.ObjectField("Inventory Sound:", myTarget.inventorySound, typeof(AudioClip), false) as AudioClip; } GUILayout.Label("Object Inventory Reference", EditorStyles.boldLabel); myTarget.isInventoryItem = EditorGUILayout.Toggle("Is also inventory item?", myTarget.isInventoryItem); if (myTarget.isInventoryItem) { // Create a string List of the field's names (for the PopUp box) List <string> labelList = new List <string>(); int i = 0; if (AC.KickStarter.inventoryManager.items.Count > 0) { foreach (InvItem _item in AC.KickStarter.inventoryManager.items) { labelList.Add(_item.label); // If an item has been removed, make sure selected variable is still valid if (_item.id == myTarget.invID) { myTarget.invNumber = i; } i++; } if (myTarget.invNumber == -1) { // Wasn't found (item was possibly deleted), so revert to zero ACDebug.LogWarning("Previously chosen item no longer exists!"); myTarget.invNumber = 0; myTarget.invID = 0; } myTarget.invNumber = EditorGUILayout.Popup("Inventory item:", myTarget.invNumber, labelList.ToArray()); myTarget.invID = AC.KickStarter.inventoryManager.items[myTarget.invNumber].id; } } }