InvalidOperationException: EnsureRunningOnMainThread can only be called from the main thread
See original GitHub issueHi, I get this error when working with your class. Until now it works fine, and I can’t see where is the problem (I mean, I think I commented all the last changes before the error appears but still keep there…). Do you think there is some solution in your class? Here is the full stack error. Thank you.
InvalidOperationException: EnsureRunningOnMainThread can only be called from the main thread
UnityEngine.Object.EnsureRunningOnMainThread () (at <c6b52566f59b49fc861a7812a1ea2f6b>:0)
UnityEngine.Object.GetInstanceID () (at <c6b52566f59b49fc861a7812a1ea2f6b>:0)
UnityEngine.Object.IsNativeObjectAlive (UnityEngine.Object o) (at <c6b52566f59b49fc861a7812a1ea2f6b>:0)
UnityEngine.Object.CompareBaseObjects (UnityEngine.Object lhs, UnityEngine.Object rhs) (at <c6b52566f59b49fc861a7812a1ea2f6b>:0)
UnityEngine.Object.op_Equality (UnityEngine.Object x, UnityEngine.Object y) (at <c6b52566f59b49fc861a7812a1ea2f6b>:0)
UnityEngine.Object.Equals (System.Object other) (at <c6b52566f59b49fc861a7812a1ea2f6b>:0)
System.Collections.Generic.ObjectEqualityComparer1[T].Equals (T x, T y) (at <c2a97e0383e8404c9fc0ae19d58f57f1>:0) System.Collections.Generic.Dictionary
2[TKey,TValue].FindEntry (TKey key) (at <c2a97e0383e8404c9fc0ae19d58f57f1>:0)
System.Collections.Generic.Dictionary2[TKey,TValue].ContainsKey (TKey key) (at <c2a97e0383e8404c9fc0ae19d58f57f1>:0) GenericDictionary
2[TKey,TValue].ContainsKey (TKey key) (at Assets/Code/Libraries/GenericDictionary.cs:92)
GenericDictionary`2[TKey,TValue].OnAfterDeserialize () (at Assets/Code/Libraries/GenericDictionary.cs:50)
Issue Analytics
- State:
- Created 9 months ago
- Comments:19 (8 by maintainers)
Top GitHub Comments
I’ve kept this issue open since I suspected there was some issue with static initialization. I don’t use singletons so haven’t encountered this issue myself, but sounds like it’s pretty tricky to reproduce since it doesn’t occur immediately.
Ok, can be… If I can reproduce the bug anyway I’ll advice you. Thank you for all 😃