Lifecycle (presenter)
Big concepts
WillPushEnterAsync initializes the visible part of the view.
This is to avoid blank screens or incorrect indicators during animations that switch screens.
By default, everything that should be displayed in the View is taken from the Model and associated with the View in Presenter.
The data values in the Model are all reactive by default.
DidPushEnter defines the interactive behavior of the view.
DidPushEnter occurs after the end of all transition animations.
The reason for registering all user action processing, such as button events, after all transition animations have ended is because:
Too many unexpected things happen if the user can provide input during the transition.
From the user's perspective, it doesn't matter if they can interact during the transition, such as clicking a button.
From the user's perspective, it's more concerning to see a blank or incomplete screen during the transition animation, which is fine because WillPushEnterAsync handles all of that.
Put the key value of the Asset into an attribute.
AssetName
Put the asset key value in the attribute. I recommend that all Assets be managed as Addressable. A simple implementation is to put the prep in the Resources folder and give it a key value. For more information, see the official readme for the UnityScreenNavigator library.
Finished Code
Last updated