Unity: 2021.2.0f
UCC: 2.4.2
Hi there. I am noticing that some of my Projectile GameObjects would stick to my shield when they hit. I have a bit of a custom setup in that I have created some meteors that have Projectile components but these are not fired from the normal ShootableWeapon (info below) etc. When some projectiles impact and I have "apply Impact" on my shield I get an exception firing.
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Items.AnimatorAudioStates.Sequence.NextState () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/AnimatorAudioStates/Sequence.cs:55)
Opsive.UltimateCharacterController.Items.AnimatorAudioStates.AnimatorAudioStateSet.NextState () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/AnimatorAudioStates/AnimatorAudioStateSet.cs:217)
Opsive.UltimateCharacterController.Items.Actions.Shield.Damage (System.Object source, System.Single amount) (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/Shield.cs:127)
Opsive.UltimateCharacterController.Objects.Destructible.OnCollision (System.Nullable`1[T] hit) (at Assets/Opsive/UltimateCharacterController/Scripts/Objects/Destructible.cs:226)
Opsive.UltimateCharacterController.Objects.Projectile.OnCollision (System.Nullable`1[T] hit) (at Assets/Opsive/UltimateCharacterController/Scripts/Objects/Projectile.cs:66)
Opsive.UltimateCharacterController.Objects.TrajectoryObject.Move (UnityEngine.Vector3& position, UnityEngine.Quaternion rotation) (at Assets/Opsive/UltimateCharacterController/Scripts/Objects/TrajectoryObject.cs:588)
Opsive.UltimateCharacterController.Objects.TrajectoryObject.FixedUpdate () (at Assets/Opsive/UltimateCharacterController/Scripts/Objects/TrajectoryObject.cs:512)
Turning off ApplyImpact makes these go away for the most part, but during initialisation there is still one left along a different code path.
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Items.AnimatorAudioStates.AnimatorAudioStateSet.DeserializeAnimatorAudioStateSelector (Opsive.UltimateCharacterController.Items.Item item, Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion characterLocomotion) (at Assets/Opsive/UltimateCharacterController/Scripts/Items/AnimatorAudioStates/AnimatorAudioStateSet.cs:129)
Opsive.UltimateCharacterController.Items.Actions.Shield.Awake () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/Shield.cs:89)
UnityEngine.GameObject:SetActive(GameObject, Boolean)
Flightless.UCC.Abilities.UseShield:AbilityStarted() (at Assets/_DArk/Scripts/abilities/UseShield.cs:36)
Opsive.UltimateCharacterController.Character.Abilities.Ability:StartAbility(Int32) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Ability.cs:476)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion:TryStartAbility(Ability, Boolean, Boolean) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1198)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion:TryStartAbility(Ability, Boolean) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1065)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion:TryStartAbility(Ability) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1054)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler:TryStartAbility(Ability) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:235)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler:UpdateAbilityInput(Ability[]) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:131)
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)
The Projectile behaviour looks like this
And my "shield" is as follows.
My setup is as follows. When the shield is pulled out with a custom action, I just enable a GO. This GO has the Shield script on it. When my projectiles (meteors with the Projectile component) are instantiated I call Initialize on them and then let everything goes. For the most part when they hit the ground they explode nicely etc but if they hit my shield, they can stick there.
Any ideas? I can turn off ApplyImpact if I need to but the initialisation is still a bit of a problem and I'd like to know what I'm doing wrong.
UCC: 2.4.2
Hi there. I am noticing that some of my Projectile GameObjects would stick to my shield when they hit. I have a bit of a custom setup in that I have created some meteors that have Projectile components but these are not fired from the normal ShootableWeapon (info below) etc. When some projectiles impact and I have "apply Impact" on my shield I get an exception firing.
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Items.AnimatorAudioStates.Sequence.NextState () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/AnimatorAudioStates/Sequence.cs:55)
Opsive.UltimateCharacterController.Items.AnimatorAudioStates.AnimatorAudioStateSet.NextState () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/AnimatorAudioStates/AnimatorAudioStateSet.cs:217)
Opsive.UltimateCharacterController.Items.Actions.Shield.Damage (System.Object source, System.Single amount) (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/Shield.cs:127)
Opsive.UltimateCharacterController.Objects.Destructible.OnCollision (System.Nullable`1[T] hit) (at Assets/Opsive/UltimateCharacterController/Scripts/Objects/Destructible.cs:226)
Opsive.UltimateCharacterController.Objects.Projectile.OnCollision (System.Nullable`1[T] hit) (at Assets/Opsive/UltimateCharacterController/Scripts/Objects/Projectile.cs:66)
Opsive.UltimateCharacterController.Objects.TrajectoryObject.Move (UnityEngine.Vector3& position, UnityEngine.Quaternion rotation) (at Assets/Opsive/UltimateCharacterController/Scripts/Objects/TrajectoryObject.cs:588)
Opsive.UltimateCharacterController.Objects.TrajectoryObject.FixedUpdate () (at Assets/Opsive/UltimateCharacterController/Scripts/Objects/TrajectoryObject.cs:512)
Turning off ApplyImpact makes these go away for the most part, but during initialisation there is still one left along a different code path.
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Items.AnimatorAudioStates.AnimatorAudioStateSet.DeserializeAnimatorAudioStateSelector (Opsive.UltimateCharacterController.Items.Item item, Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion characterLocomotion) (at Assets/Opsive/UltimateCharacterController/Scripts/Items/AnimatorAudioStates/AnimatorAudioStateSet.cs:129)
Opsive.UltimateCharacterController.Items.Actions.Shield.Awake () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/Shield.cs:89)
UnityEngine.GameObject:SetActive(GameObject, Boolean)
Flightless.UCC.Abilities.UseShield:AbilityStarted() (at Assets/_DArk/Scripts/abilities/UseShield.cs:36)
Opsive.UltimateCharacterController.Character.Abilities.Ability:StartAbility(Int32) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Ability.cs:476)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion:TryStartAbility(Ability, Boolean, Boolean) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1198)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion:TryStartAbility(Ability, Boolean) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1065)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion:TryStartAbility(Ability) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1054)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler:TryStartAbility(Ability) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:235)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler:UpdateAbilityInput(Ability[]) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:131)
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)
The Projectile behaviour looks like this
And my "shield" is as follows.
My setup is as follows. When the shield is pulled out with a custom action, I just enable a GO. This GO has the Shield script on it. When my projectiles (meteors with the Projectile component) are instantiated I call Initialize on them and then let everything goes. For the most part when they hit the ground they explode nicely etc but if they hit my shield, they can stick there.
Any ideas? I can turn off ApplyImpact if I need to but the initialisation is still a bit of a problem and I'd like to know what I'm doing wrong.