Cheo
Active member
Hello, here's an issue I stumbled upon while experimenting with a ladder. In the demo scene, if you put Atlas close enough to the ladder's top so that he's able to directly detect it, you get about five errors when starting the game, here's the first one :
And here's the video as usual :
As I explain in it, it's not an actual issue in my own project, but I guess it could be for any project that features saving and loading - the error should logically happen if a player saves while near a ladder's top and then loads. Lastly, since the error comes from DetectObjectAbilityBase, I'm wondering if this could happen with other abilities, but I haven't done any real testing on that front. Hope this can be taken a look at, thanks.
C#:
[Exception] NullReferenceException: Object reference not set to an instance of an object
DetectObjectAbilityBase.ValidateObject() at ./Packages/com.opsive.ultimatecharactercontroller/Runtime/Character/Abilities/DetectObjectAbilityBase.cs:362
360: if (raycastHit.HasValue) {
361: float angle;
--> 362: var castDirection = m_UseLookDirection ? m_LookSource.LookDirection(true) : m_Transform.forward;
363: var objectFaces = obj.GetCachedParentComponent<Objects.ObjectForwardFaces>();
364: if (objectFaces != null) {
LadderClimb.ValidateObject() at /Opsive/UltimateCharacterController/Add-Ons/Climbing/Scripts/LadderClimb.cs:177
175: }
--> 177: return m_Ladder.CanMount(m_CharacterLocomotion) && base.ValidateObject(obj, raycastHit);
178: }
LadderClimb.CanStartAbility() at /Opsive/UltimateCharacterController/Add-Ons/Climbing/Scripts/LadderClimb.cs:140
138: // The object must be a ladder.
139: var hitObject = m_RaycastResult.collider.gameObject;
--> 140: if (!ValidateObject(hitObject, m_RaycastResult)) {
141: return false;
142: }
UltimateCharacterLocomotion.UpdateAbilities() at ./Packages/com.opsive.ultimatecharactercontroller/Runtime/Character/UltimateCharacterLocomotion.cs:659
657: (m_MoveTowardsAbility == null || !m_MoveTowardsAbility.IsActive)) {
658: // The ability message can show if the non-automatic/manual ability can start.
--> 659: ability.AbilityMessageCanStart = ability.Enabled && ability.CanStartAbility();
660: }
661: } else if (ability.IsActive && ability.StopType == Ability.AbilityStopType.Automatic) {
UltimateCharacterLocomotion.OnImmediateTransformChange() at ./Packages/com.opsive.ultimatecharactercontroller/Runtime/Character/UltimateCharacterLocomotion.cs:1806
1804: {
1805: // Do a pass on trying to start any abilities and items to ensure they are in sync.
-->1806: UpdateAbilities(m_Abilities);
1807: UpdateAbilities(m_ItemAbilities);
1808: if (m_OnAnimationUpdate != null) {
Opsive.Shared.Events.InvokableAction`1[T1].Invoke() at <a7e4033e44164ac88e1f576bd6b4b49c>:0
EventHandler.ExecuteEvent[T1]() at <a7e4033e44164ac88e1f576bd6b4b49c>:0
UltimateCharacterLocomotion.OnEnableInternal() at ./Packages/com.opsive.ultimatecharactercontroller/Runtime/Character/UltimateCharacterLocomotion.cs:476
475: EventHandler.ExecuteEvent(m_GameObject, "OnCharacterMoving", false);
--> 476: EventHandler.ExecuteEvent(m_GameObject, "OnCharacterImmediateTransformChange", true);
477: EventHandler.ExecuteEvent(m_GameObject, "OnCharacterActivate", true);
478: }
CharacterLocomotion.OnEnable() at ./Packages/com.opsive.ultimatecharactercontroller/Runtime/Character/CharacterLocomotion.cs:463
461: }
--> 463: OnEnableInternal();
464: }
And here's the video as usual :
As I explain in it, it's not an actual issue in my own project, but I guess it could be for any project that features saving and loading - the error should logically happen if a player saves while near a ladder's top and then loads. Lastly, since the error comes from DetectObjectAbilityBase, I'm wondering if this could happen with other abilities, but I haven't done any real testing on that front. Hope this can be taken a look at, thanks.