hi, does anyone know any solutions to reloading a scene in hdrp 2021.3.14f1 when my player dies? I'm using a simple scene reset, "SceneManager.LoadScene(SceneManager.GetActiveScene().name);", but there are references to objects that apparently no longer exist after this function is called. I just want to know if anyone else has ran into a similar problem what their experiences were and if there was any solutions. I know about self-referencing but I'd rather not do that
#reload scene on player death issues
1 messages · Page 1 of 1 (latest)
Maybe you should share your errors from the console and all of the other relevant information #854851968446365696
!code
Posting code
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
On one of my weapons: MissingReferenceException: The object of type 'Gun' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
("Gun" is the name of one of my scripts) Gun.StartReload () (at Assets/TestScene/Weapons/WeaponScripts/Gun.cs:34)
PlayerShoot.Update () (at Assets/TestScene/Weapons/WeaponScripts/PlayerShoot.cs:20)
My weapon script has references to an animation, instantiating a prefab, the transform position of where it'll be instantiated, a particle effect perfab, and a raycast transform position. It seems that Unity thinks that one of these or all of these references are deleted after the scene resets and therefor an error occurs
@night crypt sorry for not providing more detail earlier, wasn't at my pc