using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class helloworld : MonoBehaviour {
// Use this for initialization
void Start() {
print("hello world");
}
// Update is called once per frame
void Update () {
When you say you “cannot connect to the debugger”, do you mean that you are not seeing the “hello world” text appear in the console within Unity, or something else?
hello rob I am trying to add the script to the main cameraCan’t add script behaviour TMP_CoroutineTween. The script needs to derive from MonoBehaviour!
Could you post your full script please Connor, the above looks like it has some code missing.
Incidentally, your post looks the same as the one your posted the other day, which got a reply and a solution. Is this the same problem? e.g. your class name “helloworld” does not match your filename “helloworld.cs”?
There is an item on the Unity Issue Tracker site at the moment which mentions the “TMP_CoroutineTween” text, e.g. the Unity is reporting the wrong filename in the error, but your issue looks to be the same as your previous post?
You should need to be worrying about the debugger in Visual Studio at this time.
Try the following;
make sure you script’s filename is “helloworld.cs”, no spaces, special characters or anything else
within the script, make sure that the class name is “helloworld”, e.g.
public class helloworld : MonoBehaviour
{
}
within Unity, click on the Main Camera GameObject, you will see the Inspector updates and shows various properties for the camera, check to see if your script is attached to the Main Camera as a component.
If it is, you should just be able to run the game by clicking on the Play button within Unity, you don’t need to worry about Visual Studio at this point.
If it isn’t attached, drag the helloworld.cs script file from the Assets folder and drop it just under the Add Component button within the Inspector, you will then see that it is added as a script component.
Now retry running the game.
It’s hard to tell from your screenshot but it looks like you may be trying to run the debugger from Visual Studio instead of running the Game from within Unity.
If you are still having problems after trying the above then let me know and I’ll talk you through the steps, slowly and one by one, but from a new project so we both know where you are etc
Did you try any of my suggestions in my previous reply? Specifically my comment about whether or not you were running from Visual Studio instead of from Unity?
What it looks like you are doing, and it is a bit hard to tell from only the screenshot, but it looks like you are editing your code in Visual Studio, and then have pointed the debug editor to Unity. You are then pressing Run within Visual Studio, and this is generating your error.
Do this around the other way…
create your script files initially from within Unity
open them from within Unity, Visual Studio will launch and open the file
make your code change and press save within Visual Studio
We’ll mark this topic as closed but if you run into any other issues just pop another post up, either on the forum in the Q&A on Udemy. Try to be as descriptive as you can in your posts though, screenshots can be helpful but explanations of the issue are too.