Say I have a scene with many parts, and I want to “isolate” only those parts with a script called “SomeScript”. Unity has the super handy search bar in the hierachy now- just how could I replicate this via script?
ie, I’d like to have a function that does something like:
function IsolateObjects()
{
var filteredObjects = GameObjects.FancyHierarchySelectByScript("SomeScript");
FancyIsolate(filteredObjects);
}
I understand that I could loop through each and every game object in the scene, checking for the script, and add it to an array to “Isolate”, but that could be really, really slow. Also, I’d still need to “isolate” it, which is the really neat part that Unity’s hierarchy search does. Everything else fades to grey, and only the filtered objects can be selected/manipulated.
So- does anybody know of a way to tap into this? Would be much appreciated, thanks!
You could go into the project view, find the script, right click the script, Find References In Scene, and then select all those objects in the Hierarchy…
Hello, I succeed by using a second camera with a new layer and occlusion culling. On the main camera you can add a post effet to make all the background grey.