Simply following the tutorial
I am using TPS only, assault rifle, and it doesn't seem to matter if I use the demo rifle item or my own custom item.
I can create the item and pickup object fine, add to scene and set the Item Pickup script settings, but running the scene results in errors.
One thing to note is the item pickup object has all the correct scripts added, but I don't see the yellow bounding box gizmos as shows in the tutorial video.
In script ItemAction.cs - Awake()
This line fails: m_Character = characterLocomotion.gameObject;
Since characterLocomotion is null.
Error:
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Items.Actions.ItemAction.Awake () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/ItemAction.cs:58)
Opsive.UltimateCharacterController.Items.Actions.UsableItem.Awake () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/UsableItem.cs:121)
Opsive.UltimateCharacterController.Items.Actions.ShootableWeapon.Awake () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/ShootableWeapon.cs:344)
I don't understand why the pickup item expects there to be a parent character?
I have a TPS character, with no items, that works fine by itself.
I can create the item and pickup object fine, add to scene and set the Item Pickup script settings, but running the scene results in errors.
One thing to note is the item pickup object has all the correct scripts added, but I don't see the yellow bounding box gizmos as shows in the tutorial video.
In script ItemAction.cs - Awake()
This line fails: m_Character = characterLocomotion.gameObject;
Since characterLocomotion is null.
C#:
protected override void Awake()
{
base.Awake();
m_GameObject = gameObject;
m_Item = m_GameObject.GetCachedComponent<Item>();
var characterLocomotion = m_GameObject.GetCachedParentComponent<UltimateCharacterLocomotion>();
m_Character = characterLocomotion.gameObject;
Error:
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Items.Actions.ItemAction.Awake () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/ItemAction.cs:58)
Opsive.UltimateCharacterController.Items.Actions.UsableItem.Awake () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/UsableItem.cs:121)
Opsive.UltimateCharacterController.Items.Actions.ShootableWeapon.Awake () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/ShootableWeapon.cs:344)
I don't understand why the pickup item expects there to be a parent character?
I have a TPS character, with no items, that works fine by itself.
Last edited: