gui layer unity code example
Example: set object layer unity
// Put the game object in the ignore raycast layer (2)using UnityEngine;
using System.Collections;public class ExampleClass : MonoBehaviour
{
void Example()
{
gameObject.layer = 2;
}
}