public void Update() { switch (state) { case State.Loading: if (_request.isDone) { if (_request.error != null) { state = State.Destroyed; } else { gameObject = GameObject.Instantiate(_request.asset as GameObject); state = State.Loaded; if (Onloaded != null) { Onloaded(this); } } } break; case State.Loaded: break; case State.Destroyed: if (gameObject != null) { GameObject.Destroy(gameObject); gameObject = null; } foreach (var item in assets) { item.Value.Release(); } _request.Release(); _request = null; assets.Clear(); WidgetManager.Remove(this); break; default: break; } }