How to re-enable displabled compenents on revive?

Hello, I noticed that when my player dies it disabled Unity Input, Inventory, and a couple of other scripts but when I revive these stay disabled how do I re-enable these when I revive? I haven't changed the actual revive ability script at all nor do I override it.
 
When the character revives in the demo scene the OnCharacterActivate/OnEnableGameplayInputs will be sent. This is done for you though so I'm curious why yours isn't working. Are you able to reproduce it within a fresh project?
 
Weird it works in a fresh project. The components still aren't active on revive also the first person objects script(not gameobject) isn't active either.

Im getting an error tho:
UnassignedReferenceException: The variable m_Animator of PunAnimatorMonitor has not been assigned. You probably need to assign the m_Animator variable of the PunAnimatorMonitor script in the inspector. Opsive.UltimateCharacterController.Character.AnimatorMonitor.EnableAnimator (System.Boolean enable) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/AnimatorMonitor.cs:974) Opsive.UltimateCharacterController.Character.Abilities.Ragdoll.EnableRagdoll (System.Boolean enable, UnityEngine.Vector3 force, UnityEngine.Vector3 position) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Ragdoll.cs:110) Opsive.UltimateCharacterController.Character.Abilities.Ragdoll.Awake () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Ragdoll.cs:83) Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.set_Abilities (Opsive.UltimateCharacterController.Character.Abilities.Ability[] value) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:192) Opsive.UltimateCharacterController.Utility.Builders.AbilityBuilder.SerializeAbilities (Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion characterLocomotion) (at Assets/Opsive/UltimateCharacterController/Scripts/Utility/Builders/AbilityBuilder.cs:148) Opsive.UltimateCharacterController.Editor.Inspectors.Character.UltimateCharacterLocomotionInspector.SerializeAbilities () (at Assets/Opsive/UltimateCharacterController/Editor/Inspectors/Character/UltimateCharacterLocomotionInspector.cs:1693) Opsive.UltimateCharacterController.Editor.Inspectors.Utility.InspectorUtility.DrawObject (System.Object obj, System.Boolean drawHeader, System.Boolean friendlyNamespacePrefix, UnityEngine.Object target, System.Boolean drawNoFieldsNotice, System.Action changeCallback) (at Assets/Opsive/UltimateCharacterController/Editor/Inspectors/Utility/InspectorUtility.cs:377) Opsive.UltimateCharacterController.Editor.Inspectors.Character.UltimateCharacterLocomotionInspector.DrawSelectedAbility (System.Int32 index) (at Assets/Opsive/UltimateCharacterController/Editor/Inspectors/Character/UltimateCharacterLocomotionInspector.cs:1125) Opsive.UltimateCharacterController.Editor.Inspectors.Utility.ReorderableListSerializationHelper.DrawReorderableList (UnityEditorInternal.ReorderableList& reorderableList, Opsive.UltimateCharacterController.Editor.Inspectors.InspectorBase inspector, System.Array drawnObject, System.String serializedData, UnityEditorInternal.ReorderableList+HeaderCallbackDelegate drawHeaderCallback, UnityEditorInternal.ReorderableList+ElementCallbackDelegate drawElementCallback, UnityEditorInternal.ReorderableList+ReorderCallbackDelegate reorderCallback, UnityEditorInternal.ReorderableList+AddCallbackDelegate addCallback, UnityEditorInternal.ReorderableList+RemoveCallbackDelegate removeCallback, UnityEditorInternal.ReorderableList+SelectCallbackDelegate selectCallback, System.Action`1[T] drawSelectedElementCallback, System.String key, System.Boolean requireOne, System.Boolean indentList) (at Assets/Opsive/UltimateCharacterController/Editor/Inspectors/Utility/ReorderableListSerializationHelper.cs:90) Opsive.UltimateCharacterController.Editor.Inspectors.Character.UltimateCharacterLocomotionInspector.<GetDrawCallback>b__32_0 () (at Assets/Opsive/UltimateCharacterController/Editor/Inspectors/Character/UltimateCharacterLocomotionInspector.cs:300) Opsive.UltimateCharacterController.Editor.Inspectors.StateSystem.StateBehaviorInspector.OnInspectorGUI () (at Assets/Opsive/UltimateCharacterController/Editor/Inspectors/StateSystem/StateBehaviorInspector.cs:93) UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <480b5a3bd3214ce5831f6dd8c68fdc55>:0) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
 
Last edited:
Are you running the latest version? Line 974 of AnimatorMonitor is a curly bracket so it's not able to cause a null reference.
 
Unfortunately I'm not able to support version 2.2.4 as there have been many fixes/improvements since that version. If you are able to reproduce the error within the latest version I can definitely take a closer look at it though.
 
Unfortunately I'm not able to support version 2.2.4 as there have been many fixes/improvements since that version. If you are able to reproduce the error within the latest version I can definitely take a closer look at it though.

This is still happening after I updated to the latest version. Same issue with Unity Input, Inventory, Ik disabled.
 
Last edited:
Can you tell me how to reproduce it within a fresh project?

I've confirmed that its to do with trying to start the revive ability through code characterLocomotion.TryStartAbility(reviveAbility);. If you enable the Start on death bool in the Revive ability it works properly. Starting it through code causes this to happen.
 
Last edited:
In the demo scene I started the revive ability programmatically and the components kept enabled. The revive ability doesn't actually do the disabling so maybe you are disabling them in another way?
 
In the demo scene I started the revive ability programmatically and the components kept enabled. The revive ability doesn't actually do the disabling so maybe you are disabling them in another way?

I've looked and found nothing if I check the Start on Death in my project it works without problems.
 
Hm yeah I tried to reproduce this and couldn't either, calling Revive through code seems to work fine. You've had this happen in a fresh project with the latest version, right? Maybe you could share the repro project and I can take a quick look (please don't share it on the forum though, you can send it in a DM).
 
Andrew sent me the repro project and I am having trouble reproducing it. Can you create a new scene with just your respawn script and send it to support@opsive.com? The demo scene has a lot going on so I'd like to take a closer look with a basic setup.
 
Top