Tempus
New member
I need to be able to "Instantiate" my character at run time. But the character and all related scripts do not "link up" and results in the character being un usable.
I also can not set the character to be set as "DO NO DISTROY" either as scene changes require character to load when scene loads.
I did have a related question on this HERE regarding being able to move the character around at runtime.
As such, I managed to get it to drag around and be placed where I like by not having some scripts active at run time.
By some magic, it was working as needed. But I needed to rebuild one of my scenes, and something was lost. No idea what magic setting was used or if was a happy quirk. But now the second part where the character loads and is played is not working.
Some related errors:
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Game.KinematicObjectManager.Update () (at Assets/Opsive/UltimateCharacterController/Scripts/Game/KinematicObjectManager.cs:839)
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Camera.CameraControllerHandler.Update () (at Assets/Opsive/UltimateCharacterController/Scripts/Camera/CameraControllerHandler.cs:103)
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.ThirdPersonController.Camera.ObjectFader.FadeCharacter () (at Assets/Opsive/UltimateCharacterController/Scripts/ThirdPersonController/Camera/ObjectFader.cs:265)
Opsive.UltimateCharacterController.ThirdPersonController.Camera.ObjectFader.Update () (at Assets/Opsive/UltimateCharacterController/Scripts/ThirdPersonController/Camera/ObjectFader.cs:251)
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Character.CharacterIK.GetDefaultLookAtPosition () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/CharacterIK.cs:372)
Opsive.UltimateCharacterController.Character.CharacterIK.LookAtTarget () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/CharacterIK.cs:758)
Opsive.UltimateCharacterController.Character.CharacterIK.OnAnimatorIK (System.Int32 layerIndex) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/CharacterIK.cs:592)..............................................................
---------------------------------------------------------------------------------------------------------------------------------
I have script in place to reactivate all deactivated scripts when I load the given scene. Some are ones that I deactivated myself for PART A , and the rest are ones that deactivated themselves for some reason related to "NOT FINDING THE CHARACTER" even though it is loaded in ( instantiated from code ) when the scene is loaded.
But even though I do all at load, it still fails to work. Only a character already part of the scene works. but that does not help in any way.
Why is it not possible to instantiate a character?
To clarify, the character is placed into the scene as intended in the position and orientation required. the problem is that all the code fails to HOOK together.
I also can not set the character to be set as "DO NO DISTROY" either as scene changes require character to load when scene loads.
I did have a related question on this HERE regarding being able to move the character around at runtime.
As such, I managed to get it to drag around and be placed where I like by not having some scripts active at run time.
By some magic, it was working as needed. But I needed to rebuild one of my scenes, and something was lost. No idea what magic setting was used or if was a happy quirk. But now the second part where the character loads and is played is not working.
Some related errors:
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Game.KinematicObjectManager.Update () (at Assets/Opsive/UltimateCharacterController/Scripts/Game/KinematicObjectManager.cs:839)
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Camera.CameraControllerHandler.Update () (at Assets/Opsive/UltimateCharacterController/Scripts/Camera/CameraControllerHandler.cs:103)
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.ThirdPersonController.Camera.ObjectFader.FadeCharacter () (at Assets/Opsive/UltimateCharacterController/Scripts/ThirdPersonController/Camera/ObjectFader.cs:265)
Opsive.UltimateCharacterController.ThirdPersonController.Camera.ObjectFader.Update () (at Assets/Opsive/UltimateCharacterController/Scripts/ThirdPersonController/Camera/ObjectFader.cs:251)
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Character.CharacterIK.GetDefaultLookAtPosition () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/CharacterIK.cs:372)
Opsive.UltimateCharacterController.Character.CharacterIK.LookAtTarget () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/CharacterIK.cs:758)
Opsive.UltimateCharacterController.Character.CharacterIK.OnAnimatorIK (System.Int32 layerIndex) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/CharacterIK.cs:592)..............................................................
---------------------------------------------------------------------------------------------------------------------------------
I have script in place to reactivate all deactivated scripts when I load the given scene. Some are ones that I deactivated myself for PART A , and the rest are ones that deactivated themselves for some reason related to "NOT FINDING THE CHARACTER" even though it is loaded in ( instantiated from code ) when the scene is loaded.
But even though I do all at load, it still fails to work. Only a character already part of the scene works. but that does not help in any way.
Why is it not possible to instantiate a character?
To clarify, the character is placed into the scene as intended in the position and orientation required. the problem is that all the code fails to HOOK together.
Last edited: