D
D
Daniel2021-02-22 04:45:57
C++ / C#
Daniel, 2021-02-22 04:45:57

How to separate model from view in Unity?

I don't understand how to separate all game logic from graphics, animation. Like how to create a model without inheritance of MonoBehaviour, so that there would not be a single GameObject in it, I try through delegates. It turns out that in this class there are more than 5-10 parameters that need to be passed. And somehow I don’t think it’s right to declare them in gameManager and then transfer them somewhere else.
And what is gameManager? What exactly should he be responsible for, for rendering or the logic of the game? Are there any other standardized names.
Does anyone have a simple example, otherwise I have a problem that it seems like 2 gameManagers each time. One for the input output, and the other for the logic of the game (but I can’t do it without MonoBehaviour inheritance, as a result, all sorts of gameObjects get into it, which I just can’t figure out how to get rid of (encapsulate).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DanielMcRon, 2021-02-22
@daniil14056

What?


Like how to create a model without inheritance of MonoBehaviour, so that there would not be a single GameObject in it, I try through delegates. It turns out that in this class there are more than 5-10 parameters that need to be passed.

Why would you want to do this? Inherit from MonoBehaviour and pass the data object as one parameter.

And what is gameManager? What exactly should he be responsible for, for rendering or the logic of the game?

Exactly what is GameManager? You have created something for yourself and now you are asking such questions. As a rule, such names are given to a class or object that monitors or performs any actions in the game. If there is a player animation class, then its name will be something like this "PlayerAnimationController"
You have heard enough of what and accept these names / concepts as standards. Learn a little Unity and how to format code/names in scripts

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question