I'm working on a unity project it's a visualization software, so most of the game mechanics are based on buttons, sliders, color-picker updating my GamesObjects.
I can't figure out how to organize my UI implementation. Is it a good idea to apply some kind of MVC pattern to unity, any idea how to do it (i found some article about that but they weren't clear to me) ?
Currently I'm adding UI elements in the scene. An empty game objets called UIManager is holding scripts concerning the UI. Those scripts hold references to UI elements, add a listener to them and contain methods called by the event.
My approach is correct? How to improve it ? My UI Manager contain scripts like this one : public class someMenuGUI : MonoBehaviour {
public Button enable;
public void Start(){
enable.onClick.AddListener(Enable);
}
public voidEnable(){GameObject[] Objs = Object.FindObjectsOfType (typeof(GameObject)) as GameObject[]; // then do something on them};
Thanks, and sorry for my poor english.
Aucun commentaire:
Enregistrer un commentaire