- Home /
Problem is not reproducible or outdated
Enum has "Unknown resolve error"
In my code, I have an enum that says the keyword is Unknown resolve error. The enum can't be used, and doesn't exist.
using UnityEngine;
using System.Collections;
public class BaseWeapon : BaseStatItem {
public enum WeaponTypes{
SWORD,
STAFF,
DAGGER,
BOW,
SHEILD,
POLEARM
}
private WeaponTypes weaponType;
public WeaponTypes WeaponType
{
get{return weaponType;}
set{weaponType = value;}
}
}
Can someone please help? I'm following this video and I have no clue what I'm doing wrong.
Unity 4.5.5f1 MonoDevelop 4.0.1
Your piece of code works fine. There has to be something else in the project that produces this error. Are you actually sure it's in this file? Could you please copy the exact error message from the console and tell us which line it's complaining?
I can copy this right into a script and it compiles without any problems. Are you sure you didn't call another enum "WeaponTypes", maybe in one of the baseclasses?
Never paraphrase the error in a question. If you don't understand it, then you don't know what is important about it.
Show us the entire error message, as printed by Unity, or we cannot help very much,
Answer by Hydravolt · Nov 15, 2014 at 12:47 AM
Really Sory, but after my PC crashed everything worked fine. The errors were all in Mono, I didn't even need to go into Unity to see them. It was all because of that Unknown resolve error, which I can't recreate. Can anyone tell me what Unknown resolve error even means?
The compiler simply can't reslove a name since it's unknown for some reason. One reason could be that the C# solution / project file was corrupt / missing when you viewed that file. So it might miss all the assembly references and references to other scripts in your project.
To be honest i have the feeling some people are a little bit too quick in posting a question here. Usually before posting a question you do "what you can" to solve a problem yourself. Things like closing and reopening $$anonymous$$onoDev. and or Unity should be something quite early in the list of thing you might want to try. Especially if you get a rare error where you don't find much information about. (did you even search ?!?)
Or before they have read a basic C# book.
These forums aren't to write your code for you or to $$anonymous$$ch you C#. There are lots of resources for the latter, and you should do you own work for the former. At least read and work the Goldstone book.
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Changing the direction of a prefab when colliding with an object 0 Answers
Illuminating a 3D object's edges OnMouseOver (script in c#)? 1 Answer
NPC Class looking for help 1 Answer