|
Can't figure out what I'm doing wrong here but it keeps coming up with a NullReferenceException error on the CompareTag line. Maybe I'm using it incorrectly? Have tried everything.
(comments are locked)
|
|
You're trying to access the parent of a GameObject which does not have a parent. Check if it has a parent and then compare the tag. Try this: Solves the error. Though now doesn't work as intended (needs to trigger for everything, not just objects with parents) — will have to investigate another method. Thanks.
Mar 27 '12 at 10:25 PM
Essential
(comments are locked)
|
|
Does your GameObject with collider, got a parent with tag player? maybe try to put to your object the tag Player not at your parent, and then, if (!other.CompareTag ("Player")) { Debug.Log("something other than player"); } in your exemple, if an object, without parent stay in your trigger, it will cast an NullReferenceException. I think
(comments are locked)
|
|
I think that should be Apologies for this answer, I somehow managed to overlook the parent reference in your code:(
Mar 27 '12 at 10:51 AM
AtomicHippo
That's okay, thanks for trying. :)
Mar 27 '12 at 11:07 AM
Essential
Took back my downvote. Please check your code before posting an answer.
Mar 27 '12 at 12:03 PM
farooqaaa
(comments are locked)
|
