Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

How to toggle the visibility of a group of objects

I want to create 2 collections each of which contains several object. I want to toggle the visibility between each other.
I want to give a command to speech manager and change toggle the visibility between each of the groups.
After creating these collections in Unity, I don't know even how to get access to them in c# code. I only know I can broadcast message to them and trigger the callback functions.

Thanks.

Best Answer

Answers

  • @ShayneKiekebosch said:
    What code do you currently have?

    Do you have the speech manager all set up?

    What have you tried in terms of toggling the visibility?

    I would recommend trying this:

    GameObject collectionToToggle = GameObject.Find("nameOfCollectionGameObject");
    
    //To make invisible
    collectionToToggle.SetActive(false);
    
    //To make visible
    collectionToToggle.SetActive(true);
    

    Thank you for your reply. I worked it out.
    Part of your code is right, but
    GameObject.Find function can only work for active objects. So it needs another way to work around.
    For example, I associated member variable with components in Unity to make it work.

Sign In or Register to comment.