Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

need help with script :(

Discussion in 'Scripting' started by galfedida1212, Apr 17, 2020.

  1. galfedida1212

    galfedida1212

    Joined:
    Apr 17, 2020
    Posts:
    11
    i started watching a unity tutorial and reached part 2

    when he created a cube he added a script component and so did i,just when he typed Debug.log("hello");
    his Debug changed color in visual studio and mine didnt :( i tryed saving it and running and i got error cs0117
    code:
    Code (CSharp):
    1. using System.Collections;
    2. using UnityEngine;
    3. public class PlayerMovement : MonoBehaviour
    4. {
    5.     // Start is called before the first frame update
    6.     void Start()
    7.     {
    8.         Debug.Log("hello");
    9.     }
    10.     // Update is called once per frame
    11.     void Update()
    12.     {
    13.        
    14.     }
    15. }
    picture in attached files
     

    Attached Files:

  2. davidnibi

    davidnibi

    Joined:
    Dec 19, 2012
    Posts:
    424
    Script file name needs to be the exact same name as the class name!

    lolz.cs should be PlayerMovement.cs
     
  3. galfedida1212

    galfedida1212

    Joined:
    Apr 17, 2020
    Posts:
    11
    it didnt fix anything :( i did rename it still Debug didnt change
     

    Attached Files:

  4. SpartianTheDev

    SpartianTheDev

    Joined:
    Jan 17, 2019
    Posts:
    11
    It is Debug.Log not Debug.log
    Also you can try
    Code (CSharp):
    1. print("hello");