Q&A: Optimizing Unity Development – A Deep Dive into Reference Finder with Francisco Leites
In this blog post, we revisit the latest advancements in Reference Finder since our last conversation a few months ago, offering insights from Francisco Leites, the mind behind the tool. We’ll explore the inspiration, challenges, and key features, including the ‘Missing Components’ functionality. Let’s dive into the Q&A with Francisco.
What inspired you to create the Reference Finder tool, and how does it make finding Unity references easier?
Sometimes, I would spend a significant amount of time searching for references that could lead to the bugs I was trying to solve, whether in some of my projects or Exaud’s internal Unity project at the time, owing to the complexity of the scenes. I had to manually search for references, and occasionally, the built-in reference lookup didn’t do a great job helping out. The Reference Finder empowers users or developers to look up all references to a Unity object across all open scenes, prefabs, and ScriptableObjects in the project. This significantly reduces search time, enabling us developers to concentrate on the problems at hand.
What’s new with the Reference Finder tool since May? Any standout features or significant changes you’d like to mention?
Internally, I’ve been working on integrating a new feature that allows developers to search for ‘Missing Components’— those leftover components that stay attached to an object after deleting the source script, potentially causing errors and warnings. The objective is to assist developers in identifying null references within objects throughout the scene, aiding in resolving errors related to missing references.
Why did you decide to make the Reference Finder tool open source? What benefits do you see for other developers?
I’ve always preferred to share my projects on the internet, even though this is the first time doing it with one of my own. My hope is that if someone finds it helpful, it could lead to improvements, discussions, and maybe even inspire other projects. Plus, it’s free, which can be a real help for people on tight budgets. It’s a win-win situation in my book.
Can you share a challenge you faced while developing, like disabling drag and drop features, and how you overcame it?
Most of the challenges I faced were due to the lack of documentation and examples for the specific Unity version I was using. I had to search the internet for answers without knowing exactly what to look for, especially when it came to disabling drag and drop for object fields. Additionally, some issues arose from simple testing, like discovering that the prefab stage has no name, unlike other stages.
You stressed the importance of code maintainability and readability. What steps did you take to ensure these qualities during Reference Finder’s development?
I established certain rules for myself, aligning with the coding conventions of the language I’m using—C# in this case. This way, anyone familiar with C# projects and these conventions could comprehend certain aspects of the code without delving into specific definitions (e.g., recognizing that private variables start with an underscore ‘_’). Additionally, I opted for descriptive names for types, variables, and methods to make it easier to follow.
Looking ahead, you mentioned plans for unit testing, search filters, and code refactoring. Which one is the top priority, and what challenges do you foresee in implementing it?
In the foreseeable future, I’m considering prioritizing testing as it would expedite error detection in case the code deviates from the expected behavior. However, testing becomes quite challenging when the project heavily depends on Unity’s framework and packages. This complicates assertion and unit tests since I can’t ‘mock’ any of the Unity objects due to their specific implementation. Abstracting my code from Unity is necessary, but it might take some time to achieve.
Comments are closed