Fade groups of objects in Unity3d.
I would like to share a small library I made for fading any kind of objects. It works similar to unity3d canvas group but can be used not only for UI. It also allows defining global groups with shared string ID so you will be able to fade several groups simultaneously. Please note that your materials/shaders must support transparency in order to get it work.
Global Render Group String id for global group. You can easily fade groups simultaneously if they share the same ID.
Ignore parent group If this group is a child of another ignores alpha changes of the parent.
Child Renders Only If this is toggled you won’t be able manually to add/remove nodes to a group. The group works automatically and nodes are cleaned up when the object no longer a child of the render group.
Deactivate On Fade Deactivates all nodes of the group when their alpha equals to zero. Activates them when alpha is bigger than zero.
Nodes It’s a list of all nodes that are used in a group. It can contain render or graphic nodes ( UI ) depending on what you put inside the group. Nodes are utility components that contain cached values. They are scriptable objects.
Child Groups All groups that are children of selected render group.
Materials Props - Id of shader color to look for alpha. You can define several ID. For example, if you are going to fade particles they use _TintColor.
Methods to use in RenderGroup.cs :
// Value to fade to and the time of transition public void Fade(float value,float time)
// Fade global group. Use globalgroup ID, value to fade and transition time RenderGroupGlobal.FadeGlobalGroup ("Group",0.0f,0.5f);
Get the unity package from my Dropbox
Follow me on my Twitch channel where I’m showing creation process of the Battlecruiser.