Hi all,
Got a problem with an Enumerations and an if Statement.
I have my script #1 :
using UnityEngine;
using System.Collections.Generic;
public class weaponProperties : MonoBehaviour {
[System.Serializable]
public enum weaponType {
Range,
Melee
}
public weaponType Type;
}
And I have my if statement in Script #2 :
weaponProperties weaponPropertiesComponent = GetComponent<weaponProperties>(); //get the script#1
if (weaponPropertiesComponent.Type == weaponPropertiesComponent.Type.Range) {
//do something
}
I got this error :
error CS0176: Static member `weaponProperties.weaponType.Range’ cannot be accessed with an instance reference, qualify it with a type name instead
I Just wanted to change things on my code when I check Range or Melee on my enumeration
I dont understand how to get my enum Type on the if statement in the Script#2… Someone can help me please ?
Thanks in advance !