- Home /
Answer by rutter · Apr 07, 2012 at 08:15 PM
You can find a list of layers in your project's Tag Manager.
It's very easy to set a GameObject's layer in the inspector, too, if you don't actually need dynamic layer switching.
I will need to you the layer dynamically. I can define the name of the user layers and call them in code easily, but I can't seem to get an object into a "Builtin Layer." Unity doesn't recognize the layer name "Ignore Raycast," which is what it is called in the tag manager...
This works fine for me:
Layer$$anonymous$$ask.NameToLayer("Ignore Raycast")
If you're trying to set gameObject.layer
to a string, it'll error out because the value is actually an integer. The NameToLayer() function lets you map a layer's name to its index.
thank you, that works for me. I also found out that the integer for that particular layer is "2"
If the question is answered, can you mark it as answered?
Answer by Silvermurk · Nov 28, 2016 at 09:42 AM
IgnoreRaycast layer is int 4 if someone is still reading)
Your answer
Follow this Question
Related Questions
Ignore Touch 2 Answers
Ignoring an object (using raycast with layers) is not working 1 Answer
Make object block a raycast 1 Answer
How to make an object to look at Raycast Hit Point? 1 Answer
call a function of another object 2 Answers