#show your code and the error

1 messages · Page 1 of 1 (latest)

valid phoenix
#

This is the code itself

#

here's the error

tender ridge
valid phoenix
#

and this is the line that crashes it, since it still tries to get the grabbedObject

tender ridge
valid phoenix
#

Yes it's further down in the same code. But in the else statement from the first pic I have isGrab = false. And the second one should only get called if inGrab is true

valid phoenix
#

sure

#

the first part is around line 425

tender ridge
#

so if the object was destroyed you're going to still have inGrab == true and the destroyed grabbed object reference

#

also your code requires the button being pressed before it checks if the grabbed object was destroyed, so regardless of frame timing you could run into this issue

valid phoenix
#

so put the 940 in LateUpdate, would that work?

tender ridge
#

Side note - this file is quite long and complicated and doing way too much stuff. You should probably move something as complicated as the grabbing logic out into its own separate script

tender ridge
valid phoenix
valid phoenix
tender ridge
#

and ability for others to read it