public static void Create(Map.Note mapNote) { UnityMainThreadDispatcher.Instance().Enqueue(() => { GameObject gameObject = Instantiate(Prefab); NoteObject noteObjComp = gameObject.GetComponent <NoteObject>(); noteObjComp.MapNote = mapNote; noteObjComp.Load(); }); }