private IEnumerator Start()
        {
            MinecraftSynchronizationContext.InitializeSynchronizationContext();
            SyncContext = SynchronizationContext.Current;

            WorldSettings settings = WorldSettings.Active;

            DataManager = new DataManager(settings.ResourcePackageName);

            yield return(DataManager.InitBlocks());

            yield return(DataManager.InitItems());

            yield return(DataManager.InitMaterials());

            Initialized       = false;
            Active            = this;
            m_PlayerTransform = m_Player.transform;
            m_CameraTransform = m_MainCamera.transform;

            Initialize(settings);

            yield return(DataManager.DoLua());

            DataManager.LuaFullGC();
            GC.Collect();
        }
Exemplo n.º 2
0
 public static void InitializeSynchronizationContext()
 {
     if (!(Current is MinecraftSynchronizationContext))
     {
         MinecraftSynchronizationContext context = new MinecraftSynchronizationContext(Thread.CurrentThread.ManagedThreadId);
         SetSynchronizationContext(context);
     }
 }
        private void LateUpdate()
        {
            if (!Initialized)
            {
                return;
            }

            ChunkManager.SyncLateUpdateOnMainThread();

            MinecraftSynchronizationContext.ExecuteTasks();

#if UNITY_EDITOR
            Debug.Assert(SynchronizationContext.Current is MinecraftSynchronizationContext);
#endif
        }