Help please

can’t connect to the debugger

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 () {

Hello Connor, welcome to the community! :slight_smile:

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?


See also;

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?


See also;

can’t add the script to the main camera

Hi Connor,

This is because your filename and class name do not match.

If you look at your filename you will see that there is a space in it, e.g. “hello world.cs”

Remove the space from the filename and you should be ok.

Hi Rob I have taken the space out still having issues

Hi Connor,

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 :slight_smile:

hi rob can you help me with this 37%20PM

Hi Connor,

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
  • DO NOT click run within Visual Studio
  • Go back into Unity and press the Play button

Let me know how you get on.

thanks for the help rob

1 Like

Has that helped Connor, is it working as expected now?

That has worked thank you looking forward to make a game

1 Like

Awesome… you are now on your way.

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.

Have fun with the rest of the course :slight_smile:

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

Privacy & Terms