Runtime Error

magique

Active member
When I run the Demo scene for the Agility pack I get the following error continuously:

NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.StateSystem.StateManager.CombineStates (Opsive.UltimateCharacterController.StateSystem.State state, System.Boolean active, Opsive.UltimateCharacterController.StateSystem.State[] states) (at Assets/Opsive/UltimateCharacterController/Scripts/StateSystem/StateManager.cs:403)
Opsive.UltimateCharacterController.StateSystem.StateManager.ActivateStateInternal (Opsive.UltimateCharacterController.StateSystem.State state, System.Boolean active, Opsive.UltimateCharacterController.StateSystem.State[] states) (at Assets/Opsive/UltimateCharacterController/Scripts/StateSystem/StateManager.cs:382)
Opsive.UltimateCharacterController.StateSystem.StateManager.SetStateInternal (UnityEngine.GameObject gameObject, System.String stateName, System.Boolean active) (at Assets/Opsive/UltimateCharacterController/Scripts/StateSystem/StateManager.cs:328)
Opsive.UltimateCharacterController.StateSystem.StateManager.SetState (UnityEngine.GameObject gameObject, System.String stateName, System.Boolean active) (at Assets/Opsive/UltimateCharacterController/Scripts/StateSystem/StateManager.cs:270)
Opsive.UltimateCharacterController.Character.Abilities.Ability.SetState (System.Boolean active) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Ability.cs:542)
Opsive.UltimateCharacterController.Character.Abilities.Ability.AbilityStopped (System.Boolean force) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Ability.cs:729)
Opsive.UltimateCharacterController.Character.Abilities.SpeedChange.AbilityStopped (System.Boolean force) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/SpeedChange.cs:103)
Opsive.UltimateCharacterController.Character.Abilities.Ability.StopAbility (System.Boolean force, System.Boolean fromController) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Ability.cs:679)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.TryStopAbility (Opsive.UltimateCharacterController.Character.Abilities.Ability ability, System.Boolean force) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1425)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.TryStopAbility (Opsive.UltimateCharacterController.Character.Abilities.Ability ability) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1377)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler.TryStopAbility (Opsive.UltimateCharacterController.Character.Abilities.Ability ability) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:241)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler.UpdateAbilityInput (Opsive.UltimateCharacterController.Character.Abilities.Ability[] abilities) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:119)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler.UpdateAbilityInput () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:98)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler.Update () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:73)
 
Can you tell me how to reproduce? You have TPC, correct? I just tried the following in a fresh project:

1. Imported TPC 2.1.9
2. Imported the Agility Pack 1.0.4
3. Updated the layer and button mappings
4. Opened the Agility Pack demo scene
5. Hit play

The agility scene played without any errors.
 
OK, so it doesn't come up immediately. But I do see other erros immediately when I play. Like the following:


Error: The state FirstPerson on Sword (Opsive.UltimateCharacterController.Items.Item) does not have a preset. Ensure each non-default state contains a preset.
UnityEngine.Debug:LogError(Object)
Opsive.UltimateCharacterController.StateSystem.StateManager:InitializeInternal(GameObject, IStateOwner, State[]) (at Assets/Opsive/UltimateCharacterController/Scripts/StateSystem/StateManager.cs:103)
Opsive.UltimateCharacterController.StateSystem.StateManager:Initialize(GameObject, IStateOwner, State[]) (at Assets/Opsive/UltimateCharacterController/Scripts/StateSystem/StateManager.cs:67)
Opsive.UltimateCharacterController.StateSystem.StateBehavior:Awake() (at Assets/Opsive/UltimateCharacterController/Scripts/StateSystem/StateBehavior.cs:27)
Opsive.UltimateCharacterController.Items.Item:Awake() (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Item.cs:202)


Error: The state SwordShield on Sword (Opsive.UltimateCharacterController.FirstPersonController.Items.FirstPersonPerspectiveItem) does not have a preset. Ensure each non-default state contains a preset.
UnityEngine.Debug:LogError(Object)
Opsive.UltimateCharacterController.StateSystem.StateManager:InitializeInternal(GameObject, IStateOwner, State[]) (at Assets/Opsive/UltimateCharacterController/Scripts/StateSystem/StateManager.cs:103)
Opsive.UltimateCharacterController.StateSystem.StateManager:Initialize(GameObject, IStateOwner, State[]) (at Assets/Opsive/UltimateCharacterController/Scripts/StateSystem/StateManager.cs:67)
Opsive.UltimateCharacterController.StateSystem.StateBehavior:Awake() (at Assets/Opsive/UltimateCharacterController/Scripts/StateSystem/StateBehavior.cs:27)

Error: The state Run on Sword (Opsive.UltimateCharacterController.FirstPersonController.Items.FirstPersonPerspectiveItem) does not have a preset. Ensure each non-default state contains a preset.
UnityEngine.Debug:LogError(Object)
Opsive.UltimateCharacterController.StateSystem.StateManager:InitializeInternal(GameObject, IStateOwner, State[]) (at Assets/Opsive/UltimateCharacterController/Scripts/StateSystem/StateManager.cs:103)
Opsive.UltimateCharacterController.StateSystem.StateManager:Initialize(GameObject, IStateOwner, State[]) (at Assets/Opsive/UltimateCharacterController/Scripts/StateSystem/StateManager.cs:67)
Opsive.UltimateCharacterController.StateSystem.StateBehavior:Awake() (at Assets/Opsive/UltimateCharacterController/Scripts/StateSystem/StateBehavior.cs:27)

and

Error: The first person perspective is imported but the first person melee weapons do not exist. Ensure the First Person Controller or UFPM is imported.
UnityEngine.Debug:LogError(Object)
Opsive.UltimateCharacterController.Items.Actions.MeleeWeapon:Awake() (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/MeleeWeapon.cs:298)


My steps are as follows:

1. Imported TPC 2.1.9
2. Updated the layer and button mappings
3. Imported Ultimate FPS 2.1.9
4. Updated the layer and button mappings
5. Imported the Agility Pack 1.0.4
6. Update the layer and button mappings
7. Opened the Agility Pack demo scene
8. Hit play
9. Run and round and try all the different features. At some point I start seeing the errors.

I am using Unity 2018.4.6f1
 
UFPS doesn't include melee weapons so that's likely the cause of the errors. If you upgrade UFPS to the First Person Controller then you should be good to go. If you don't want to upgrade you can create separate projects and import TPC + Agility or UFPS + Agility. I can take a look at ensuring the Agility Pack is compatible with UFPS + TPC though as well.
 
Top