Search Unity

How to add component of ThirdPersonController in script?

Discussion in 'Scripting' started by pcjjdy, Jun 25, 2017.

  1. pcjjdy

    pcjjdy

    Joined:
    Jun 25, 2017
    Posts:
    3
    Hi, I download third person demo from standard asset and it has ThrdPersonController script.
    Now I want to add this component in script so I remove it and use
    Code (CSharp):
    1. MainPlayer[Cameraindex].AddComponent<UnityStandardAssets.Characters.ThirdPerson.ThirdPersonUserControl>();
    After I run it, components look like this:

    So I wonder how to add component of ThirdPersonController for my gameObject because I can't find ThirdPersonController key word in C# script.
     
  2. BTCallahan

    BTCallahan

    Joined:
    Jun 6, 2015
    Posts:
    71
    What happen when you use
    Code (CSharp):
    1. MainPlayer[Cameraindex].AddComponent<UnityStandardAssets.Characters.ThirdPerson.ThirdPersonController>();
    "
     
  3. pcjjdy

    pcjjdy

    Joined:
    Jun 25, 2017
    Posts:
    3


    This is the result of running:
     
  4. BTCallahan

    BTCallahan

    Joined:
    Jun 6, 2015
    Posts:
    71
    I'm not sure I follow. So telling it to add a ThirdPersonController script causes it to add a ThirdPersonUserControl script instead?
     
  5. pcjjdy

    pcjjdy

    Joined:
    Jun 25, 2017
    Posts:
    3
    MainPlayer[Cameraindex].AddComponent<UnityStandardAssets.Characters.ThirdPerson.ThirdPersonController>();

    OR

    MainPlayer[Cameraindex].AddComponent<ThirdPersonController>();

    Neither of them exists. No types or namespaces like this.
     
  6. BTCallahan

    BTCallahan

    Joined:
    Jun 6, 2015
    Posts:
    71
    Does Unity Editor allow you to edit the ThirdPersonController script?