Culling Mask troubles...

Ok, I am having some troubles with the Culling Mask property of the camera. I think it may just be that I am doing something wrong.

I created a new layer, and put two GUITexts on it. I want them to not render under that layer. From what I got out of it, when Culling Mask is set to Everything, it renders all layers. So if I deselect the layer I created to not render stuff under Culling Mask, it should not render them? Is there something else I am missing, or does this not work with GUIText?

It doesn’t work with gui texts yet.
I will fix that for 1.1.1.

So how should I make it so they dont render? I tried enabling disabling them but it didn’t seem to work. What I did is set them to have a tag, and did this:

var textArray = GameObject.FindGameObjectsWithTag("EnterName");
        for (var object in textArray)
        {
            object.active = true;
        }

But it pops up with this error: !IsActive ()

object.active = false; should work.

And you can use guilElement.enabled = false;

Ok, thanks! I seem to have gotten that sorted out.

Ok, before what I just did was did your suggestion (use guilElement.enabled = false;), but now I really do need to set the object active or inactive using that code above, and I am still having this problem with 1.1.1. Any ideas?

Not sure what exactly you think is not working.

I just tried and culling masks seem to work with guiText in my test.
Also guiText.enabled = false; seems to work.

var objectArray = GameObject.FindGameObjectsWithTag("EnterName"); 
        for (var object in objectArray) 
        { 
            object.active = true; 
        }

That code seems to not work. Not sure why,

I did some tests. Connecting a GameObject to the script, and then just making it active works fine, but trying to iterate through the objectArrays and activating them that way didnt seem to activate anything.

Try placing this code inside the Start function instead of at the script level.

I was doing it in the Awake function already, but I tried it in Start instead, and it does the same thing. I can look in the Hierarchy and they are not activated, and then when I try to run a function attached to the GameObjects that activate, it pops up with the error !IsActive()

And yes, I made sure there are objects with that Tag in the scene.

It shouldn’t matter that I am activating a Parent, and then also activating all the children as well? They all have that tag. I was able to activate them manually by attaching them to the script.

Try Debug.Log (object.name, object); in the for loop.
This might give you a better idea where it is going wrong.

Hmm, doing that doesn’t seem to output anything. Here is a screenie of Unity open, on one of the GameObjects I am trying to activate, and the corresponding code.

http://kevin.macteens.com/activateproblem.jpg

All the find with tag, find by name functions do not return inactive objects.

OK that explains a ton of it. Is it possible to activate the Window (Empty Game Object) and then also activate all of its children?

There is gameObject.SetActiveRecursively(true);

I am not sure if using active state is the best way to go for you.
Often times loading another level is better.

If you do gui the scripting tutorials last chapter shows a good pattern on how to do game loading screens, levels and game managers.