Search code examples
c#unity-game-engine

Print function not working in c# on Unity-VS code


When I write a code in C# the unity console it does not show the output. The code editor is Visual Studio. Please give quick answer.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TestScript : MonoBehaviour
{
    // Start is called before the first fra
    void Start()
    {
        print("hello world");
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}

but the output is:

enter image description here I searched on Google but I didn't find the right answer


Solution

  • make sure you attached your script to a game object by going 'add component' on the inspector menu after selecting the game object