public override void OnInspectorGUI() { //this is so that it always updates correct target childScript = (AIWeaponControllerChild)target; EditorGUILayout.LabelField("Weapon Controller"); EditorGUILayout.Space(); showFoldout1 = EditorGUILayout.Foldout(showFoldout1, "Main Referencing Objects"); //main referencing objects if (showFoldout1) { EditorGUILayout.Space(); bulletToUse = EditorGUILayout.ObjectField("Bullet Object", bulletToUse, typeof(Object), true) as GameObject; bulletPosition = EditorGUILayout.ObjectField("Bullet Position Creation", bulletPosition, typeof(Object), true) as GameObject; muzzleFlashManager = EditorGUILayout.ObjectField("Flash Managing Object", muzzleFlashManager, typeof(Object), true) as GameObject; magazineObjectThrow = EditorGUILayout.ObjectField("Empty Magazine Object", magazineObjectThrow, typeof(Object), true) as GameObject; magazineThrowPosition = EditorGUILayout.ObjectField("Magazine Creation Object", magazineThrowPosition, typeof(Object), true) as GameObject; ikLeftHand = EditorGUILayout.ObjectField("IK Left Hand", ikLeftHand, typeof(Transform), true) as Transform; ikRightHand = EditorGUILayout.ObjectField("IK Right Hand", ikRightHand, typeof(Transform), true) as Transform; EditorGUILayout.Space(); } showFoldout2 = EditorGUILayout.Foldout(showFoldout2, "Ammo Properties"); //ammo stuff if (showFoldout2) { EditorGUILayout.Space(); ammoCurrent = EditorGUILayout.FloatField("Ammo In Current Magazine", ammoCurrent); ammoInNewMagazine = EditorGUILayout.FloatField("Ammo In New Magazine", ammoInNewMagazine); magazines = EditorGUILayout.FloatField("Amount Of Magazines", magazines); secondsToReload = EditorGUILayout.FloatField("Seconds To Reload", secondsToReload); throwForce = EditorGUILayout.FloatField("Magazine Throw Force", throwForce); EditorGUILayout.Space(); } showFoldout3 = EditorGUILayout.Foldout(showFoldout3, "Shooting Properties"); //shoot stuff if (showFoldout3) { shootForce = EditorGUILayout.FloatField("Shoot Force", shootForce); recoilVertical = EditorGUILayout.FloatField("Recoil Vertical", recoilVertical); recoilHorizontal = EditorGUILayout.FloatField("Recoil Horizontal", recoilHorizontal); recoilSpeedMax = EditorGUILayout.FloatField("Recoil Max Speed", recoilSpeedMax); } if (GUI.changed) { SetVariablesToChild(); } else { GetVariablesFromChild(); } }
public override void OnInspectorGUI() { //this is so that it always updates correct target childScript = (AIWeaponControllerChild)target; EditorGUILayout.LabelField("Weapon Controller"); EditorGUILayout.Space(); showFoldout1 = EditorGUILayout.Foldout(showFoldout1, "Main Referencing Objects"); //main referencing objects if(showFoldout1) { EditorGUILayout.Space(); bulletToUse = EditorGUILayout.ObjectField("Bullet Object" ,bulletToUse, typeof(Object), true) as GameObject; bulletPosition = EditorGUILayout.ObjectField("Bullet Position Creation" ,bulletPosition, typeof(Object), true) as GameObject; muzzleFlashManager = EditorGUILayout.ObjectField("Flash Managing Object" ,muzzleFlashManager, typeof(Object), true) as GameObject; magazineObjectThrow = EditorGUILayout.ObjectField("Empty Magazine Object" ,magazineObjectThrow, typeof(Object), true) as GameObject; magazineThrowPosition = EditorGUILayout.ObjectField("Magazine Creation Object" ,magazineThrowPosition, typeof(Object), true) as GameObject; ikLeftHand = EditorGUILayout.ObjectField("IK Left Hand" ,ikLeftHand, typeof(Transform), true) as Transform; ikRightHand = EditorGUILayout.ObjectField("IK Right Hand" ,ikRightHand, typeof(Transform), true) as Transform; EditorGUILayout.Space(); } showFoldout2 = EditorGUILayout.Foldout(showFoldout2, "Ammo Properties"); //ammo stuff if(showFoldout2) { EditorGUILayout.Space(); ammoCurrent = EditorGUILayout.FloatField("Ammo In Current Magazine", ammoCurrent); ammoInNewMagazine = EditorGUILayout.FloatField("Ammo In New Magazine", ammoInNewMagazine); magazines = EditorGUILayout.FloatField("Amount Of Magazines", magazines); secondsToReload = EditorGUILayout.FloatField("Seconds To Reload", secondsToReload); throwForce = EditorGUILayout.FloatField("Magazine Throw Force", throwForce); EditorGUILayout.Space(); } showFoldout3 = EditorGUILayout.Foldout(showFoldout3, "Shooting Properties"); //shoot stuff if(showFoldout3) { shootForce = EditorGUILayout.FloatField("Shoot Force", shootForce); recoilVertical = EditorGUILayout.FloatField("Recoil Vertical", recoilVertical); recoilHorizontal = EditorGUILayout.FloatField("Recoil Horizontal", recoilHorizontal); recoilSpeedMax = EditorGUILayout.FloatField("Recoil Max Speed", recoilSpeedMax); } if(GUI.changed) { SetVariablesToChild(); } else { GetVariablesFromChild(); } }
void OnEnable() { childScript = (AIWeaponControllerChild)target; GetVariablesFromChild(); }