Ejemplo n.º 1
0
        protected override void OnUnload()
        {
            base.OnUnload();

            foreach (var o in SyncWorldObjects.ToArray())
            {
                MMW.DestroyGameObject(o);
            }
            SyncWorldObjects.Clear();

            foreach (var o in WorldObjects.ToArray())
            {
                MMW.DestroyGameObject(o);
            }
            WorldObjects.Clear();

            foreach (var p in Players.ToArray())
            {
                MMW.DestroyGameObject(p);
            }
            Players.Clear();

            MMW.DestroyGameObject(worldGO);
            MMW.DestroyGameObject(hudGO);
            MMW.DestroyGameObject(cameraTarget);

            MMW.DestroyAsset(worldData);
            MMW.DestroyAsset(Resources);
            MMW.DestroyAsset(server);

            MMW.MainCamera.GameObject.RemoveComponent(blur);

            var effs = MMW.MainCamera.GameObject.GetComponents <ImageEffect>();

            foreach (var eff in effs)
            {
                eff.Enabled = false;
            }

            GC.Collect();
        }