"The namespace `global::' already contains a definition". It only looks like 1 definition to me.

I’m trying to code the

using UnityEngine;
using System.Collections;

public class paddle : MonoBehaviour {
  
   public float paddleSpeed = 1F;
   public Vector3 playerPos;
   //public Vector3 playerPos = new Vector3(0,0,0);

   void Update ()
   {
           float yPos = gameObject.transform.position.y + (Input.GetAxis ("Vertical") * paddleSpeed);
           playerPos = new Vector3 (-17,Mathf.Clamp(yPos, -11, 11),0);
           gameObject.transform.position = playerPos;
   }

}

part of a simple Pong game and Unity is telling me "Assets/scripts/paddle.cs(4,14): error CS0101: The namespace global::' already contains a definition for paddle’ ".

I only see 1 definition, but I’m new to Unity. Ah well, it’s fortunate to have this forum to post on.

there’s probably some other script somewhere in project folders with paddle-class.

hey Brian, you have been asking quite a few code questions lately. If you’re not already using any, I’d strongly advise getting some good C# references and books to read / work through / reference, rather than only using Unity tutorials to learn some code.

Check out something like C# 4 in a Nutshell or similar books, and the MS C# documentation. (Be aware that currently Unity v5.6 uses ~C# 4 and .Net 3.5, not the latest C# 7 or .Net 4.7 framework.)

I’m guessing you just want me to get familiar with C#. Correct?

And I really don’t know what to do with your “(Be aware that currently Unity v5.6 uses ~C# 4 and .Net 3.5, not the)” suggestion. Please tell me how to be aware. Why and how (and why) do I stay away from the latest C# 7 or .Net 4.7 framework?

Thank you for your guidance and patience.

As mentioned, Unity does not support the newer versions of C# and .Net yet. The currently supported versions in Unity 5.6 are C# 4 and .Net 3.5. So, if you look around for references and books, the recent ones will be for the newer versions using features you cannot use yet. That’s why I linked to an example of a C# 4 reference.

I see. Thank you!I