Method **foo()** is running twice and messing things up - I have ruled out the following potential causes:
- Multiple instances of the script in the scene (with the ref: search of the scene hierarchy)
- Multiple subscriptions to the Notification Center post (this method subs in the Awake() function, throwing a debug next to it yields only 1 call).
- The method that posts the Notification is only run once
- The Notification is not posted in any other script (I combed over every single script using CTRL-F just to be sure)
- Edit: Also ruled out it being caused by ExecuteInEditMode, which doesn't appear in any of the relevant scripts.
*One detail regarding #3:*
The Notification that foo() is observing is posted by method **baz()** which is called by OnTriggerEnter(). This **was** calling baz() multiple times upon collision, until I used a simple boolean switch to prevent that. The boolean gets reset on OnTriggerExit(), and using debugs I've confirmed that these are each occurring once, so I am confident that this is not the cause of foo() running twice.
I realize that folks may want to see the code itself, but I'm really looking for ideas on what I can try to rule out and investigate. Posting the code here could be messy so it might be easier to link to the relevant places on GitHub if anyone is interested.
↧