Console warnings

Just a quick question:
Since a couple of lectures, I get some warnings in the console. Mainly about some variables that we defined and use in the code.

Is there a way to avoid them?

Hi Chris,

Warnings won’t stop your code from executing, however, they are often produced based on best practices. So, to avoid these, you could assign a value, although ironically, in many cases you would still be assigned null and in some cases you may not be able to assign a value, or might not want to.

For example;

[SerializeField]
private GameObject paddle1 = null;

There is something quite pleasing about clearing them all though and not having any, if however you don’t want to, just click on the Warnings icon on the top of the console window (right hand corner) - and the Console will stop displaying warnings.

Thank you very much Rob!
Now I got a better understanding. :slight_smile:

1 Like

You’re very welcome :slight_smile:

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

Privacy & Terms