Search Unity

Group opacity

Discussion in 'General Discussion' started by squirt, Jun 5, 2018.

  1. squirt

    squirt

    Joined:
    May 12, 2011
    Posts:
    26
    I want to easily control the opacity of a whole hierarchy of objects. Is there some sort of Component or script I can add at the base of the hierarchy that would allow me to do that?

    Thanks.
     
  2. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,160
    Couldn't you just give them all the same material and change the opacity through that?
     
  3. squirt

    squirt

    Joined:
    May 12, 2011
    Posts:
    26
    Not really. It's a bunch of particle systems doing different things. I know it's possible to set something up that goes into the materials of each thing in the group, but it would be much easier if that could just be inherited from the root of the tree.
     
  4. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    A canvas group van do it for UI elements. You can wrote something similar for non UI elements.
     
  5. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,052
    You could write something that gives you a similar result, but the process would be different. Like looping through all the materials and setting transparency (assuming the materials support it). Canvas is a single mesh with specific shaders. An arbitrary hierarchy of game objects would require some planning.
     
    angrypenguin and Kiwasi like this.
  6. squirt

    squirt

    Joined:
    May 12, 2011
    Posts:
    26
    Oof. Okay, thanks. I'm not the programmer on the project, I'm just a Max guy (and occasional Unity guy). In Max you just set up a visibility controller for the root object and everything linked to it will follow. So I had a hard time believing it would be as involved as the project's programmer was saying.
     
  7. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,052
    It’s not all that involved, just requires some planning and a bit of preparation depending on your project’s needs.
     
  8. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    @zombiegorilla could all the particles be placed on a layer to control visibility? I'm unaware if the visibility for a layer could be a variable to provide partial (.05) visibility of all objects, but if on/off is all that is needed, couldn't a Unity layer suffice for this?
     
  9. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    For anything more than on/off I suspect that using layers would be even more convoluted, as you'd need to then also have fine control over what the camera is doing and re-compositing the layers afterwards.

    So, I agree that planning out how it's going to work and writing a script for it is probably the way to go.
     
    theANMATOR2b likes this.