- Home /
Odd compiler and "Error CS0103"
Could anyone please point me what is the wrong in following code that causes compile error "CS0301 The name 'm_dice' does not exist in the current context"?
//NG public class MyClass : MonoBehaviour { // Define members int m_dice; int m_state;
void Start()
{
m_dice = 0;
m_state = 0;
}
}
Also following makes same error too.
//NG public class MyClass : MonoBehaviour { // Define members int m_state;
void Start()
{
m_state = 0;
}
}
However, following code does not raise compile error on Unity editor.
//OK public class MyClass : MonoBehaviour { // Define members //int m_dice; int m_state;
void Start()
{
//m_dice = 0;
m_state = 0;
}
}
I'm using Unity3.5.5f3. I can't understand this Unity compiler's behavior.
Answer by HTJ · Sep 11, 2012 at 02:42 PM
I found what is the matter.
I don't know why, but if there are some specific multi-byte characters (e.g., '態') in the code as comment and it will cause the mysterious compile error.
It seems that the multi-byte character's comment also comments out the next line's code.
e.g.)
// 状態 (This is the error trigger comment)
int m_State; // Also commented out by above comment
I think the Unity compiler misses to read multi-byte character and return code of that line.
Your answer
Follow this Question
Related Questions
All compiler errors have to be fixed before you can enter playmode 0 Answers
Warning messages are turning into Internal Compiler Errors...? 6 Answers
Unity compiler throwing fake errors? Something wrong with this script. 3 Answers
Internal Compiler Error again 1 Answer
Compiler error - wrong target 1 Answer