[Bug] Crashes Unity if event variable name is empty/null

AgeOfCosmos

New member
Hello, I setup a HasReceivedEvent handler with an event name, that points to a Variable
Unfortunately i had forgotten to set the variable's the previous evening and when i pressed play, stop Unity would crash, because OnApplicationQuit would try to deregister an event, that is null

Can there be a safeguard to prevent this?
Thanks :)
 
Yes,

I created a simple BehaviorTree like this one and it would result every now and then with an editor error in the logs when i stop / start the playmode

And the variable (String) EVENT_STOP, the value was left empty

1641326821172.png


Btw, Thanks a lot for developing this!
It made creating AI and flow of events so much easier to work with :)
 
Thanks! I reproduce the ArgumentNullException. You can fix it by first checking for null:

Code:
!string.IsNullOrEmpty(eventName.Value)) {

This is within OnStart, OnEnd, and OnBehaviorComplete.

Btw, Thanks a lot for developing this!
It made creating AI and flow of events so much easier to work with
?
 
Top