Search Unity

Question Creating a multi-purpose 'menu-toggle' class

Discussion in 'Scripting' started by eco_bach, Apr 10, 2021.

  1. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,601
    Need to create a multi-purpose 'menu-toggle class.
    Very simply this class holds a collection of objects and when one of these objects is 'selected' it becomes activated and deactivates the other objects in the collection become 'de-activated'.
    The game I'm creating has several levels or scenes. Each scene needs its own menu independent of the other scenes or levels.

    So I know I need a dictionary to hold the objects and create the collection.
    Beyond that need some feedback.
    What would be the most efficient way of adding objects to, activating and deactivating these collection objects, assuming they are activated on mouse press?