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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Why can't I GetComponent <FirstPersonController>

Discussion in 'Scripting' started by jo6x, Mar 5, 2017.

  1. jo6x

    jo6x

    Joined:
    Jan 2, 2016
    Posts:
    113
    In a script I try to reach the script FirstPersonController in de gameobject FPSController but I can't....:(
    The FirstPersonController does exist in the gameobject FPSController.
    Can someone tell me why I can't reach this, Am I doing something wrong.:oops:

    Code (CSharp):
    1. // This is what I can find:
    2. FPSController.GetComponent<FirstPersonCharacterScript> ().............
    3. //This is what I can't find:
    4. FPSController.GetComponent<FirstPersonController>()............
     
  2. johne5

    johne5

    Joined:
    Dec 4, 2011
    Posts:
    1,133
    what type of object is FPSController?
     
  3. Jeremie-de-Vos

    Jeremie-de-Vos

    Joined:
    Jun 5, 2015
    Posts:
    120
  4. jo6x

    jo6x

    Joined:
    Jan 2, 2016
    Posts:
    113
    That's the FirstPersonController (the player).
     
  5. jo6x

    jo6x

    Joined:
    Jan 2, 2016
    Posts:
    113
  6. Jeremie-de-Vos

    Jeremie-de-Vos

    Joined:
    Jun 5, 2015
    Posts:
    120
    Your welcome