This Exception happen 75% of time when i enter playmode, x of mine is monobehavior and got assigned into ecs component F (managed type) from Awake() in one of my monobehavior script (x exists in editor and i just drag and drop it into this script).
- Class A (is singleton class, not mono), has a method C that is used by OnUpdate() inside a system.
- Method C simply read data in said component F to get said x, and when the Exception I mentioned at the title occured (Exception shows the line which i use monobehavior method on x), checking x == null return true, I still can use Function that declared in x without any NullRefException,
But how is this possible?? as I said, x is monobehavior and exists in Editor (and nothing destroy it at runtime), if it is really null, why the Exception occured only when I tried to use Monobehavior methods, not those methods that I declare myself.
Thanks for reading, i will try my best to provide the code cause there are too many files.