Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question [Visual Studio] Get the references of a fonction in the scene

Discussion in 'Code Editors & IDEs' started by Fangh, Mar 14, 2022.

  1. Fangh

    Fangh

    Joined:
    Apr 19, 2013
    Posts:
    268
    Hello.

    upload_2022-3-14_9-35-52.png
    In this screenshot, Visual Studio says that this function has no reference but it is called by a UI Button in the scene.
    I bet there is a way to make Visual Studio show me where the reference is in the scene. But how ?
     
  2. DanVioletSagmiller

    DanVioletSagmiller

    Joined:
    Aug 26, 2010
    Posts:
    203
    That would be nice. There is probably an asset/VISX plugin for that. However, I'm running VS Pro with what I believe is the most updated/connected VS setup and here is what I have.

    upload_2022-3-18_11-9-32.png

    While that is close, that I can typically pull up and click to references directly in the scenes/prefabs, I don't believe that covers the ability to see when another script is calling it via a UnityEvent/UI Button call.

    To get at least these features, check your Unity installation for the latest "Visual Studio Editor"

    upload_2022-3-18_11-12-43.png

    Also check your Visual Studio installation for "Visual Studio Tools for Unity"

    upload_2022-3-18_11-14-31.png

    Please note, I'm using Unity Pro 2020.3 and Visual Studio Pro 2022. The versions and pro licensing may be part of what is needed for these capabilities. I'm not certain.
     
    Fangh likes this.
  3. Fangh

    Fangh

    Joined:
    Apr 19, 2013
    Posts:
    268
    Really cool.
    I am pretty sure it's part of the VSPro license.
     
  4. Fangh

    Fangh

    Joined:
    Apr 19, 2013
    Posts:
    268
    I have tested, and what you show @DanVioletSagmiller is for a class. For class it is working with VSCommunity. But for functions, I don't know if it is working with VSPro or not. I'm sure it does not work with VSCommunity
     
  5. jsvitek

    jsvitek

    Joined:
    Feb 28, 2018
    Posts:
    3
    Have you found solution to this @Fangh?
     
  6. Fangh

    Fangh

    Joined:
    Apr 19, 2013
    Posts:
    268
    using VSPro
     
    jsvitek likes this.
  7. mohamedkaram09

    mohamedkaram09

    Joined:
    Oct 13, 2019
    Posts:
    7
    I'm not able to enable this feature in VSCommunity 2022 integrated for Unity 2020.3.9f1.
    What am I missing ? could you help me ? @Fangh
     
  8. Fangh

    Fangh

    Joined:
    Apr 19, 2013
    Posts:
    268
    You need to Use Visual Studio Professional
     
  9. Saeed-Barari

    Saeed-Barari

    Joined:
    Jul 12, 2021
    Posts:
    51
    that's a bummer. Rider controls this pretty well for all users