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. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Legit nothing works. Mostly API stuff

Discussion in 'Getting Started' started by Gorioo, Jun 11, 2018.

  1. Gorioo

    Gorioo

    Joined:
    Jan 30, 2018
    Posts:
    3
    So yeah. I started with the 2018.2 beta version since I wanted to work with ECS, whatever.

    So I make a new C# script, open him in VS 2017, and none the unity API isn't working. VS has no idea what a character controller is, and getComponentsOfType<>() doesn't work.

    Ok, I'll fix that later. I import PostProcessingStack, and when I go to assets>create, it's not there. Whatever, I reimport it, still doesnt work.

    Im 90% sure that unity's api just isn't effecting any assets, if that makes sense.

    Anyways, it's nice that im using the 'best' game engine and also dealing with a bug which is stopping me from making any progress whatsoever.
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,840
    Well it's GetComponentsOfType<>(), not getComponentsOfType(). I suspect your other problems may be of a similar sort.

    If you want actual help, the post actual errors. If you just want to complain...
     
    jhocking likes this.
  3. Gorioo

    Gorioo

    Joined:
    Jan 30, 2018
    Posts:
    3
    becuase I'm sure that whoever programmed Post Processing Stack mistyped it also

    And if it is a typo and of similar sort, how the hell did it get published in the unity store and get over a thousand reviews giving it 5 stars?
     
  4. Gorioo

    Gorioo

    Joined:
    Jan 30, 2018
    Posts:
    3
    So. Error message:
    Assets/Scripts/Player.cs(12,18): error CS0103: The name 'GetComponentsOfType' does not exist in the current context

    and script:
    Code (csharp):
    1.  
    2. CharacterController player;
    3.  
    4.     void Start () {
    5.         player = GetComponentsOfType<CharacterController>();
    6.      
    7.     }
    8.  
     
  5. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,840
    If that's the whole script, then yeah, the compiler is right. That's complete junk. GetComponentsOfType exists only in the context of a Component script. What you have there isn't even valid C# (as there is no class declaration, for example).

    Could it be you've somehow gotten your hands on some old UnityScript (.js) file?