I have two scripts: A and B.
- Script B is attached to a child GameObject of script A’s GameObject.
- Script B has a static instance referencing its parent GameObject.
- Script A references B’s static instance.
- Script B’s static instance is set in its Awake() as such:
function Awake() {
instance = this;
}
When script A is reloaded due to an edit (while my Scene is running), it throws a NullReferenceException when it accesses script B’s static instance.
I’ve checked and B’s Awake() is not called a 2nd time.