How to make gameObjects (with children) invisible?
Hello community, I'm creating an RPG framework for mobile devices and right now I'm scripting the inventory part, so I'm searching for the most efficient way to hide/show gameObjects (ie, items that the players collect, equip and drop).
The three ways I've read about (and the reason each of them does not seem ideal) are:
Deactivating mesh renderer (but I assume the recurring operation for gameObjects with multiple children will be expensive)
Using transparent material (again, not ideal for mobile)
Deactivating the gameObject (not good because the scripts attached to it won't run, and I need them to)
So, any ideas?
Answer by Yiorgos · Nov 06, 2015 at 02:30 PM
A simplistic solution I came up with, is to just move the gameObject somewhere out of sight (eg behind the camera, or in a layer that is not rendered) in order to avoid render load but still keep it active.
It seems silly and inelegant, but I don't see anything bad about it. Am I missing something?
$$anonymous$$aybe try putting it on it's own layer and choose to render the layer or not?