It looks like you’re missing the ‘using’ statements that are supposed to be at the top of the script. These let the compiler know which namespaces to look at when referencing classes and such that are used throughout.
This is going to sound like a cop-out (and maybe somewhat harsh) response, but honestly the best thing you could do at this point would be to back up like 10 steps and start learning how to Google things.
I honest-to-God am not saying that trying to be a jerk. It’s just that you are going to run into many, many, MANY errors while working on a game project, and if you have to rely on people in the forums telling you exactly how to fix each one, you’re going to have the most frustrating experience of your life.
Instead, you can just copy the text out from that console log and paste it into Google, and chances are one of the top 5 results will inform you exactly of what’s going on. Learn how to read the error messages themselves, as they also tell you exactly where the issue is happening. So once you know why things aren’t working, and you figure out how to see where it’s going wrong, all you have to do at that point is spot the issue and fix it yourself!
If you’re overwhelmed at even the thought of writing your own code that isn’t following along with a tutorial video, you may want to proceed with getting comfortable in C# before trying to work with the Unity API. I know Unity’s marketing material would have you believe that it’s super easy to just jump in and start creating your dream game idea, but unfortunately that is a lie that isn’t serving new developers well. There’s a lot you need to learn or at least be familiar with before you should even think about starting on a game idea that’s more complicated than Pong. You can feel free to skip all that stuff (as many beginners do), and I can promise you that where you’re at now will be where you stay for as long as you’re willing to deal with the frustration before giving up.
Take your time, start at the beginning, and learn how to crawl before you try running headfirst into things.
The Yellow Book is widely regarded as a great starting resource for new C# devs, and you can download it for free from that link. Otherwise, I would think literally any course that teaches C# would be an option that puts you in a better position than you are now.
And I just want to state for clarification: I am not saying you should stop. I’m saying you skipped a bunch of steps you need to know in order to succeed at the level you’re trying to run at now. Go back and do those, and when you get back to this stage, you’ll be ready!
No idea about that OnGUIDepth error, but the second error tells you that you’re missing a semicolon at the end of Line 1.
For reference: A newly created C# script (right click in your Project window > Create > C# Script) looks like this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
It’s definitely not all you need, but it’s a good place to start.
You’re very welcome! I know it’s not fun hearing someone say that you need to go back and do a bunch of stuff that isn’t fun, but being receptive to advice is a good indicator that you’ll be able to figure all this stuff out. Keep at it!