- Home /
How can I add/modify layer to editor via code?
Does anyone know? Thanks.
Comment
You can't, sadly.
While you can change an object's assigned layer through code, you can't define additional layers and/or tags, much like you can't change the Input$$anonymous$$anager's settings (a much needed feature, I$$anonymous$$O...)
Old question but just in case someone reads it and think it is not possible. You can do it via editor scripting. I've written an article on this, http://www.plyoung.com/blog/define-unity-layers-in-script.html
[edit] Since my blog is no longer available I did a code sample on the Unity forum -> http://forum.unity3d.com/threads/adding-layer-by-script.41970/#post-2514259