Unity – Tools Of The Trade

As always, RivelloMultimediaConsulting.com/unity/ will be the central location for deep articles and tutorials, Facebook.com/RivelloMultimediaConsulting (like us!) will engage the growing RMC+Unity community, and for the latest opinions and cool links follow me at Twitter.com/srivello.

Unity3D is a powerful suite of tools (Project IDE, Code IDE, run-time) for game development. The Unity IDE is great for integrating your assets and code, setting up your scenes visually, and tweaking parameters through the powerful Inspector window. While Unity ships with a very capable code editor, MonoDevelop, serious developers prefer more powerful tools.

Here is a list of the must-have tools for Unity development.


unity_tools_600_200_banner_visual_studio_v1

Name: Visual Studio – Code Editor (Various Versions, Free to $499)

Competitor: MonoDevelop (Free), Xamarin Studio (300-1000$ / yr)

Details: Microsoft Visual Studio is an integrated development environment (IDE) from Microsoft. It includes a code editor supporting IntelliSense as well as code refactoring. Built-in languages include Unity’s C# as well as C, C++, and more.

Pros:

  • Development Environment – Focus on creating value and accomplishing task quicker with a clean, fast and powerful development environment.
  • Semantic Code Analysis – Semantics (references, declarations, etc…) not just syntax are analyzed as you type. This allows for better refactoring.
  • VisualSVNSubversion integration (GIT too)
  • Great Navigation – New ways to travel around your code, including peek.
  • UML Diagram Built In – Improving architecture through modeling

Showcase Video:


unity_tools_600_200_banner_resharper_v1

Name: ReSharper ($185 for personal, $310 for a whole team)

Details: ReSharper is a renowned productivity tool that makes Microsoft Visual Studio a much better IDE. Thousands of developers worldwide wonder how they’ve ever lived without ReSharper’s code inspections, automated code refactorings, blazing fast navigation, and coding assistance.

The ultimate Agile tool is ReSharper. It is the one thing for C# developers that removes fear of change. Refactoring is just so damn easy that change isn’t scary. – Jaco Pretorius of ThoughtWorks

Pros:

  • Analyze code quality – On-the-fly code quality analysis in C#, VB.NET, XAML, ASP.NET, ASP.NET MVC, JavaScript, CSS, HTML, and XML. ReSharper tells you right away if your code contains errors or can be improved.
  • Instantly traverse your entire solution  – Navigation features to instantly traverse your entire solution. You can jump to any file, type, or type member in no time, or navigate from a specific symbol to its usages, base and derived symbols, or implementations.
  • Eliminate errors and code smells – Instant fixes to eliminate errors and code smells. Not only does ReSharper warn you when there’s a problem in your code but it provides quick-fixes to solve them automatically.
  • Enjoy code editing helpers – Multiple code editing helpers including extended IntelliSense, hundreds of instant code transformations, auto-importing namespaces, rearranging code and displaying documentation.
  • Safely change your code base – Automated solution-wide code refactorings to safely change your code base. Whether you need to revitalize legacy code or put your project structure in order, you can lean on ReSharper.
  • Comply to coding standards – Code formatting and cleanup functionality is at your disposal to get rid of unused code and ensure compliance to coding standards.
  • More features… including generation of common code, extensible templates, internationalization assistance, and unit test runner.

Showcase Video:


unity_tools_600_200_banner_unityvs_v1

Name: UnityVS ($99 for personal, $249 for a whole team)

Details: UnityVS is the missing ‘glue’ between the Unity IDE and the Visual Studio code editor.

Pros:

  • Connect Visual Studio’s debugger to Unity to debug your scripts. Put breakpoints, inspect and modify variables and arguments and evaluate complex expressions to fix bugs promptly. Without UnityVS, Visual Studio is just a powerful yet decoupled code editor.
  • UnityVS is packed with productivity features: code snippets, wizards, tool windows such as the Unity project explorer. UnityVS sends the Unity console directly to Visual Studio.
  • A short list of essential features.

Play Unity and use breakpoints. At the breakpoint you can inspect AND EDIT the live values of any variable. If that doesn’t convince you to purchase UnityVS, you are insane. – Sam Rivello, RMC

Showcase Video:


Unity Asset Store – RMC Packages

As always, RivelloMultimediaConsulting.com/unity/ will be the central location for deep articles and tutorials, Facebook.com/RivelloMultimediaConsulting (like us!) will engage the growing RMC+Unity community, and for the latest opinions and cool links follow me at Twitter.com/srivello.

Unity Asset Store

Unity3D is a powerful suite of tools (Project IDE, Code IDE, run-time) for game development. A fantastic way to accelerate Unity & C# learning, empower development, and even make some money using the Unity Asset Store.

  • 1. In my previous article “Introduction To the Asset Store” we see a complete Intro to the Unity Asset Store including how you can Fund your Indie Game Development by creating assets. Now let’s hear from some key developers who have published successful content.
  • 2. In my second article Unity Asset Store Case Studies, several veterans discuss their success with the store.
  • 3. Now, below is the list of the Asset Store Packages created by us at RMC. Enjoy!

ASSET STORE PACKAGES

BmAb5uQIgAEuUyM

 

uEP – Unity Expose Properties

About RMC & Unity3D Rivello Multimedia Consulting (RMC) provides consulting services for applications and games. RMC specializes in Unity3D development (see our work here). Please contact us today with any questions, comments, and project quotes. As always, RivelloMultimediaConsulting.com/unity/ will be the central location for deep articles and tutorials, Facebook.com/RivelloMultimediaConsulting (like us!) will engage the growing RMC+Unity community, and for the latest opinions and cool links follow me at Twitter.com/srivello.

Why Use The Inspector?

For a complete introduction to Unity see my “Intro To Unity” Article. For a quick review: games in Unity are made up of multiple GameObjects that contain meshes, scripts, sounds, or other graphical elements like Lights. The Inspector displays detailed information about your currently selected GameObject, including all attached Components and their properties. Here, you modify the functionality of GameObjects in your scene. Any public field (publicly accessible variable) that is displayed in the Inspector can be directly modified while in edit mode and also while in play mode (the game is playing live). That is great.

The Inspector is a vital part of the Unity toolset with many powerful features. However, here I’ll focus on the specific programming-centric benefits of using the inspector.

Reasons

  • Gives us an (editable) view to all public fields on a game object.
  • Very powerful for experimentation, prototyping, and debugging.
  • Improves our interface to the code. E.g. instead of setting a color in code as #ff0000, you can have a GUI color picker in the inspector.

Example
[actionscript3]
public float myNumberField_float = 10f;
[/actionscript3]
NOTE: Only public fields are shown in the inspector.

NOTE: Adding the attribute [HideInInspector] before a public field name will allow it to be public (for coding) but not be shown in the inspector. This is outside the scope of this article, but it is quite useful sometimes.

Why Use Properties?

As we learn in C# In Depth, for every type you write, you should consider its interface to the rest of the world (including classes within the same assembly). This is its description of what it makes available, its outward persona. Implementation shouldn’t be part of that description, any more than it absolutely has to be. (That’s why I prefer composition to inheritance, where the choice makes sense – inheritance generally exposes or limits possible implementations.)

A property communicates the idea of “I will make a value available to you, or accept a value from you.” It’s not an implementation concept, it’s an interface concept. A field, on the other hand, communicates the implementation – it says “this type represents a value in this very specific way”. There’s no encapsulation, it’s the bare storage format. This is part of the reason fields aren’t part of interfaces – they don’t belong there, as they talk about how something is achieved rather than what is achieved.

I quite agree that a lot of the time, fields could actually be used with no issues in the lifetime of the application. It’s just not clear beforehand which those times are, and it still violates the design principle of not exposing implementation.

Reasons

  • Through encapsulation you now have a publicly accessible ‘thing’ just like a field, but here you can more completely control it. For example, within the set {}  you could check the incoming ‘value’ and ensure it is between 1 and 10 before accepting the change.
  • Want to break into the debugger whenever the value changes? Just add a breakpoint in the setter.
  • Want to log all access? Just add logging to the getter.
  • Properties can be used for more advanced language features (like binding) too

Example
[actionscript3]
private float myNumberProperty_float = 10f;
public float myNumberProperty
{
set {
myNumberProperty_float = value;
}
get {
return myNumberProperty_float;
}
}
[/actionscript3]

Using Properties Via Inspector

By default, while Unity allows the inspector to shows with fields (variables), it does not render properties (getter/setters).

However, now you can do it all. I created the uExposeProperties (uEP) project. It is an asset store project for free. I’m hoping the community finds great uses for it. With uEP you get the best of both worlds; benefits of the inspector as well as properties.

Reasons

  • You get the benefits of the inspector
  • You get the benefits of properties
  • Your code stays very clean (only one simple attribute is added per property)

Example

NOTE: You must download the uEP package to use this functionality. It is not included in Unity.
[actionscript3]
private float myNumberProperty_float = 10f;
[ExposeProperty]
public float myNumberProperty
{
set {
myNumberProperty_float = value;
}
get {
return myNumberProperty_float;
}

}
[/actionscript3]

Drawbacks

  • There is one major drawback: theoretical performance. The current implementation depends on the OnInspectorGUI() event which is far more expensive than not using it.
  • Any ideas on how to improve that?

Next Steps

  • Download the source-code (See ‘Member Resources’). Available Now.
  • Get uEP on the asset-store (Coming Soon!)

Member Resources

[private_Free member]Enjoy this members-only content!

[/private_Free member]