I’m having trouble with my MVP setup and could use some help
UnitModel (data)
UnitView : IUnit (iMonoBehaviour).
UnitPresenter – connects the model and view.
I have some code that uses a raycast to find a Unit through IUnit. My goal is to keep a clean separation between the game’s logic and the visuals, so that the game state can exist independently of scene objects and be rebuilt from models/
The issue is that IUnit doesn’t know anything about the model. This makes it hard to decide how to authorize or apply changes to the model when interacting with the view.
I want to stick to MVP, unless told otherwise. One idea I had was:
During initialization, bind an ID to the model and view through the presenter.
Store that ID in IUnit.
When interacting with the view, look up the corresponding model in a dictionary.
Does that make sense, or is there a better way to keep the model-view separation without breaking MVP?