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

Unable to create "Player" Type/Namespace.

Discussion in '2D' started by iFailedPreK, Dec 26, 2019.

  1. iFailedPreK

    iFailedPreK

    Joined:
    Dec 2, 2019
    Posts:
    8
    I can't create a "Player" type as shown in a YouTube video. I get this error.



    https://i.imgur.com/NIJsD1Y.png



    Why is this?

    I see people use this all the time and I also did it before but now I can't seem to create it and I don't know why.
     
  2. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    @iFailedPreK

    It would be better if you attach the image here, using Upload a File button.

    "I can't create a "Player" type as shown in a YouTube video. I get this error."

    I don't see you creating / or having any Player class already created, and that is why you most likely get the error - you don't have Player class.

    "I see people use this all the time and I also did it before but now"

    I don't quite follow you - what do you mean by people using this all the time?
     
  3. TheHammer1

    TheHammer1

    Joined:
    Oct 15, 2015
    Posts:
    25
    Why: According to your image, "the type or namespace name 'Player' could not be found". This means that there is no type named "Player": therefore you cannot use it.

    Fix: The following may be possible fixes:
    • Create a class named
      Player
      and give it your desired functionality.
    • You may have forgotten to import the script in which the
      Player
      class exists