Search Unity

Resolved Does not contain a definition for 'AddComponet' and no accesible extension method 'AddComponet'

Discussion in 'Scripting' started by Aaron2348, Nov 9, 2020.

  1. Aaron2348

    Aaron2348

    Joined:
    Dec 12, 2016
    Posts:
    328
    Hi, I've been coding and understanding errors on my own but I'm having a problem understanding what I'm doing wrong here is my code,Can someone please Help!!
    I'm trying to Instance a gameobject and add InputController.

    public class GameManager {

    private GameObject gameObject

    private static GameManager m_Instance;
    public static GameManager Instance {
    get {

    if(m_Instance == null)
    {
    m_Instance = new GameManager();
    m_Instance.gameObject = new GameObject("_gameManager");
    m_Instance.gameObject.AddComponet<InputController>();

    }
    return m_Instance;
    }
    }

    private InputController m_InputController;
    public InputController InputController{
    get {

    if(m_InputController == null)
    m_InputController = gameObject.GetComponet<InputController>();
    return m_InputController;
    }

    }

    }
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,689
    Check your spelling of that method name.
     
    Bunny83 and angrypenguin like this.
  3. Aaron2348

    Aaron2348

    Joined:
    Dec 12, 2016
    Posts:
    328
    I'm sorry but which method exactly? Sorry i just don't see what I misspelled.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,689
    Bunny83 and angrypenguin like this.
  5. Aaron2348

    Aaron2348

    Joined:
    Dec 12, 2016
    Posts:
    328
    Wow you are so right...Oh god I really do need glasses, I see exactly now, Thanks so much man, I'll make sure to spell check my code now before posting to the forum.
     
    Kurt-Dekker likes this.