Hello, I am trying to create a public variable of type GameObject that would be visible in the inspector but not required. With in the code I am checking for it’s value and proceeding accordingly. The problem is, when the script fires (runs on trigger) It errors
_ nassignedReferenceException: The variable TriggerByObject of ObjectMover_Triggers has not been assigned._
I have also tried “Try” and “Catch” with no luck. So I guess the question is “How do I make a public variable optional.” Any help would be much appreciated. Thanks!
[UPDATE]
I managed to work around my problem by creating a fake object then assigning it to my public Object variable at runtime if it was empty. I would still like to know if I missing something when it comes to unassigned public variables though.