Is what I am doing even possible??? Because it doesn't work it doesn't even throw exceptions
[AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
public class ScreenObject : Attribute
{
}
public class MenuCanvasController : MonoBehaviour
[ScreenObject] public GameObject wellcomeScreen;
[ScreenObject] public GameObject wellcomeMenuScreen;
[ScreenObject] public GameObject RegistrationScreen;
[ScreenObject] public GameObject SignInScreen;
[ScreenObject] public GameObject HomeScreen;
public static MenuCanvasController instance;
private void Awake()
{
instance = this;
}
void Update ()
{
(typeof(MenuCanvasController).GetField("wellcomeScreen").GetValue(instance) as GameObject).SetActive(false);
}
I want to make simple functions for controlling a so that my friend will stop write code like this ...
public void GoToRegistrationScreen()
{
Debug.Log("Make some transitions ");
wellcomeScreen.SetActive(false);
wellcomeMenuScreen.SetActive(false);
RegistrationScreen.SetActive(true);
SignInScreen.SetActive(false);
HomeScreen.SetActive(false);
}
Aucun commentaire:
Enregistrer un commentaire