How can I find where method GetFirstScene() is called?

Hello dear community,
I’ve come back to this course after a two week break, and I did everything explained in the video. It all worked alright. But then I wanted to check where the method GetFirstScene() from SceneLoader.cs is called. I checked all the other scripts and couldn’t find what calls the method. It took me some time to find out that it is the “Win” button which calls it.
Is there a way to check for all the instances withing both Visual Studio and Unity which refer to a particular method.
When there are only a handful of scripts, methods and objects it might not be necessary, but I can imagine that later on when there’ll be hundreds of them, it will be challenging to do that search manually.
Thanks for your time.

Hi Mike,

Within Unity you can select an asset, in this case your script, right-click and select “Find References In Scene”. The Hierarchy will be filtered to show objects which reference the selected asset. You can also use the “Select Dependencies” to find which assets/objects rely on the selected one.

Within Visual Studio you can right-click on a method and then select “Find all references”, the console will then list all of the occurrences of that method name, including its definition and calls made to it from other classes within your solution.

Hope this helps :slight_smile:


See also;

Privacy & Terms