Beginner Scripting Query

Hello,

I don’t have any real background in coding but am very much enjoying the Unity 2D course.

I am currently in section 2, module 13 which starts to expand on variables a little more and have a question.

In your lecture “int guess” is underlined (L14) and and “min guess” has an error block, however in my Visual Studio it does not tell me of these errors ,a s it does in yours. Additionally I do not get my text colouring in the way yours does. Do I need to install a plugin or define what language I’m using? I feel like I’m missing something really simple.

Hi @Canaram,

I’m sorry for the late reply. For some reason, I missed your thread in the forum. How are you getting on with this? Have you already compared your code to the Lecture Project Changes which can be found in the Resources of this lecture?

It seems one of the problems is that the variables are declared inside the Start method. They actually have to be declared at class/instance level. The compiler should have shown you an error but there seems to be a problem with Visual Studio. MonoBehaviour does not have the same colour as your classname. Please watch lecture “Fixing Visual Studio Problems” (currently #4).

Hopefully, this helped. :slight_smile:


See also:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms