#Null Checking

1 messages · Page 1 of 1 (latest)

near mountain
west radish
#

specifically the null check isn't working, this is how im doing it if it helps

near mountain
#

Does it never engage?

west radish
#

yes

near mountain
#

Hmm.

#

Does that mean it debugs the drawline fine?

west radish
#

yeah, pretty much the only thing that isn't working in the snippet is the null check

#

when destroyed the gameobject shows as missing in a list, if it helps

near mountain
#

brb I've got a yap happy family member

west radish
#

alrighty

#

looks like if i check if it isnt null the if statement executes

glad zenith
#

if theObject == null is not true, then the object has not been destroyed

near mountain
#

back

glad zenith
#

Assuming it's a UnityEngine Object

west radish
#

and yet unity still screams at me

near mountain
#

Okay so if I'm understanding this, if player selects something it drwas a line to that gameobject?

Right?

west radish
#

im using Destroy(gameObject); to destroy the object

glad zenith
#

yes

#

that's fine

glad zenith
#

note that it takes a frame to take effect

#

It's also possible that you're making some assumption about which object is destroyed that is faulty

near mountain
#

good point - have you done breakpoints to see what it's looking at, and what it's destroy?

#

Also wouldn't this result in a selection no longer being true anymore the moment it's destroyed?

west radish
#

well it certainly wouldnt be drawing a line when the object gets destroyed

#

and it is not drawing a line to the object when it gets destroyed

near mountain
west radish
#

right well, looks like i've fixed it

near mountain
#

oh?

#

what happened?

west radish
#

i was silly, and put the if check too late