Search Unity

What's the best way to turn the buttons on/off in the mobile interface?

Discussion in 'Scripting' started by unity_5fpsmegasupergiperprogramer, Sep 26, 2019.

  1. unity_5fpsmegasupergiperprogramer

    unity_5fpsmegasupergiperprogramer

    Joined:
    Dec 1, 2017
    Posts:
    101
    Hey, everybody.

    Mobile game, you have many buttons in your interface. Many of them will only be turned on/off when needed.

    How best to store a link to them?

    The standard option is that we have a class that has links to the button class (MonoBehaviour) and we call SetActive.

    Would it be better to make the "IToggle" interface for example and store the links to it? And the buttons themselves will have an implementation.

    What is the best in terms of structure and optimization.
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    The right answer depends heavily on the rest of your codebase, but I can tell you for sure that you are WAY overthinking this.
     
  3. unity_5fpsmegasupergiperprogramer

    unity_5fpsmegasupergiperprogramer

    Joined:
    Dec 1, 2017
    Posts:
    101
  4. simoo

    simoo

    Joined:
    Jul 20, 2019
    Posts:
    12