'conflicts with the imported type of same name' within same class?

I don’t understand why referencing a variable or function that is static causes this warning.

public class Mana : MonoBehaviour { // Line 6
	public static readonly Color originalColor = new Color(0, 107f/255f, 239f/255f);
	[Tooltip("Color of mana? (blueish is default)")]
	public Color currentColor = Mana.originalColor; // Line 9
...
}

Mana.cs(9,30): warning CS0436: The type `Mana’ conflicts with the imported type of same name’. Ignoring the imported type definition

Mana.cs(6,14): (Location of the symbol related to previous warning)

Note: The warning is being thrown by standalone mcs(Mono compiler with version close to Unity), not the Mono within Unity.

I think this is more related the the fact that while compiling the class Mana it doesn’t exist yet. So you can’t reference it in itself. However within the class scope you simply don’t need the clas name prefix. This should work:

public class Mana : MonoBehaviour
{
    public static readonly Color originalColor = new Color(0, 107f/255f, 239f/255f);
    [Tooltip("Color of mana? (blueish is default)")]
    public Color currentColor = originalColor;
    //[...]
}

To be honest i haven’t seen this error yet in my life, but i think it makes sense :wink:

Just used the following to avoid the warning:

public Color currentColor = originalColor;

Perhaps it is just unnecessary to reference the static variable/function of a class while within that same class.