Hello! Im trying to read enum type from another script but im getting this error
Type `Mob.Defence' does not contain a definition for `defenceType' and no extension method `defenceType' of type `Mob.Defence' could be found (are you missing a using directive or an assembly reference?)
First Script.
using UnityEngine;
using System.Collections;
public class Mob : MonoBehaviour {
[System.Serializable]
public class Defence
{
public float DefenceCount;
public DefenceType defenceType;
public enum DefenceType
{
Armor,
EnergyShield,
}
}
public Defence defence;
}
Second Script.
using UnityEngine;
using System.Collections;
public class Weapon : MonoBehaviour {
// Update is called once per frame
void Update ()
{
switch(target.gameObject.GetComponent<Mob>().defence.defenceType)
{
case Mob.Defence.DefenceType.Armor:
Debug.Log("Mob DefenceType is Armor");
break;
}
}
}