using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WeaponLayer : MonoBehaviour {
public string npcTag;
public LayerMask npcLayer;
public LayerMask playerLayer;
// Use this for initialization
void Start () {
if (gameObject.transform.root.gameObject.tag == npcTag)
{
gameObject.layer = npcLayer;
}
else
{
gameObject.layer = playerLayer;
}
}
}
I have this simple script to change between layers, which works fine, but I get this error. My layers exist and I just choose which one to have for npcLayer and which one for playerLayer. If my script sees that it has the npcTag it just changes to the npcLayer, anything else it chooses the playerLayer. What am I missing?
↧