I have basically two errors I simply can't get rid from my scripts:
1. "Unable to call X - no native object bound to the script object, or object is of incorrect type"
2. "Cannot call X() on a None object, aborting function call"
For example, one script at certain point calls RegisterForSingleUpdate() and is not able to find the native object, thus the logged error #1.
The error #2 usually happens when I try to call a SetValue() on a Global Variable. The variable simply seems to not exist anymore at that point.
They always happen when the ActiveMagicEffect is removed from the player (for example, when I cast the spell again and the previous effect is overwritten). I believe the problem here is the script keeps ticking after being removed. That is, the effect seems to be dispelled , but anything running inside the OnUpdate() event keep running till find a null reference.
So, is there a solution for this?
Thanks.