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

Visual Studio problem

Discussion in 'Scripting' started by xDawid0, Apr 1, 2018.

  1. xDawid0

    xDawid0

    Joined:
    Apr 1, 2018
    Posts:
    8
    Hellp im new to unity
    whem im typing in Visual Studio Game - it auto suggest GameObject (and i like that)
    but when im typing OnMouse or OnTrigger - nothing shows up, no tips
    it would help me a lot with learning c# and unity
    Anybody have that issue?
    ______________
    Unity 2017.4.0f1
    Visual Studio 15.6.4
    ________________
     
    Last edited: Apr 1, 2018
  2. fire7side

    fire7side

    Joined:
    Oct 15, 2012
    Posts:
    1,819
    It depends where in the script you are typing. The OnMouse methods need to be outside another method. They can't be in update or whatever.
     
  3. xDawid0

    xDawid0

    Joined:
    Apr 1, 2018
    Posts:
    8
    below "void Update"
    as new function
    void OnMouseOver

    im using a tutorial and im doing exacly like there, guy on video have that sugestion, i don't
     
  4. Pagefile

    Pagefile

    Joined:
    Feb 10, 2013
    Posts:
    51
    MonoBehaviour may be implemented as a partial class at the project level. That's the only reason I can think for it to behave like that. But this is where the documentation comes in handy. It'll give you a list of all the functions you might need

    https://docs.unity3d.com/ScriptReference/MonoBehaviour.html
     
  5. Doug_B

    Doug_B

    Joined:
    Jun 4, 2017
    Posts:
    1,596
    1. Does this happen only in this source file or in other source files as well?
    2. If you make sure that your project compiles, and then in the Update() method type "trans" - does the autocomplete show up for "transform"? What about if you press Ctrl-Space whilst the cursor is at the end of "trans"?
    If the answer is (1) "all files" and (2) "no", then try this:
    1. Close Visual Studio.
    2. Find your project folder and delete the <project>.csproj and <project>.sln files (nothing else).
    3. In Unity, double click your C# source file.
    4. When Vis Studio opens, try again. Is the auto complete fixed now?
     
  6. xDawid0

    xDawid0

    Joined:
    Apr 1, 2018
    Posts:
    8
    Nothing helped, i guess ill use documentation then.
    Thanks for answering
     
  7. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
    When you say 'below' update, do you mean inside update?
    You need to be outside
     
  8. xDawid0

    xDawid0

    Joined:
    Apr 1, 2018
    Posts:
    8
    Yeah, it was outside
    Code (CSharp):
    1. void Update ()
    2. {
    3. blablabla;
    4. }
    5. void OnMouseOver
     
  9. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
    Yeah, sorry, I see someone asked already.

    Got up-to-date VS tools for unity? (VS>Tools>Get tools and features)