0

I'm getting started with scripting in Unity and after running the attached codes. i get the error in the unity console. Any assistance for me.

Error in unity image.

enter image description here

This the the code i run in the VS for the unity.

enter code here

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

public class CubeScript : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("Start method is Called");
    }

    // Update is called once per frame
    void Update()
    {
        Debug.Log("Update is calling");
    }
}**
2
  • 1
    Do you have any other Script in your Project? Commented Apr 30, 2020 at 16:00
  • No Please. just this one. Am new to the unity platform trying to start the scripting process. Commented May 1, 2020 at 1:49

1 Answer 1

2

you have 2 Classes named CubeScript in your project. its the reason of error

Look at other script if one contains the same name of class

to avoid duplicate classes, you could add namespace too:

namespace NameOfSceneForExample
{
    public class CubeScript : MonoBehaviour
   {
   }
}
Sign up to request clarification or add additional context in comments.

2 Comments

kk...So how should the script be written for it to work?
the best solution is to add namespace see my modified answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.