16 Unity Tips for 2016

Check out our Unity-based social networking platform to see what you can do with Egowall. Then sign up for a free account and start using it to be The Real You™.

Egowall is built on a number of technologies that work in concert to allow you to be The Real You™. What does that mean? We use the “cloud,” databases, servers, as well as modern web and game development techniques to make it all come together.

A big part of this is our game engine, Unity 3d. We thought we’d start off 2016 with 16 tips you can use right now if you are getting started with Unity development.

1. Custom Layouts

Find a layout you’re comfortable with – Unity allows users to customize the UI very easily so they have access to the windows and tools they need. Check out some of the native layouts or save your own UI layout by opening the Layout drop-down menu in the upper-right corner of Unity. If you want to match the scale and position of an object in a scene you can drop an asset from your project folder directly onto that object in your scene hierarchy.

2. Custom Builds

Unity lets you create custom builds to be launched on many platforms. We build Egowall for the Web (and soon WebGL), but internally we can make PC .exe builds for various testing needs, visual feedback on new assets, or for creating in-game cinematics. Custom builds don’t even need code support. Throw a scene together, open the Build Settings, then Add Current Scene. When you build a PC or Mac app, the player will load right into your test scene.

3. Automatically Import Materials

When importing objects to Unity, you can configure them to import materials as well. By selecting an .fbx object in the Project folder, you can see its model settings in the Inspector panel. By checking the Import Materials checkbox, you’re able to bring in the materials applied to the object in whatever modeling tool was used to create it. Be sure to Apply those settings to the object! This can help streamline the process of getting your assets looking correct in Unity.

4. Drag and Drop to Match the Scale and Position of New Objects

To match the scale and position of an object in a scene, drop an asset from your project folder directly onto that object in your scene hierarchy.

5. Grouping

Grouping similar objects or sets of objects in an empty game object can help simplify your scene and make it easier to move items around, turn off different groups, and modify multiple items at one time.

6. Multiple Selection

Select multiple items in a scene and drag a material into the element slot under the Mesh Renderer, Materials, Element 0. You can use this to apply one material to multiple assets at once. This also works to set all of the object’s transforms at the same time.

7. Editor Camera Control

Single-click the coordinate on the scene view widget to position your camera in the desired position. Click one more time on the center box to switch to 2d top down/side view. This comes in handy for a more precise placement of lights, assets and probes.

8. Place Lights Close to their Subjects

Place area lights in a scene for baking. Make sure the lights are as close as possible to the ground plane of your scene to avoid uneven lighting on lower surfaces.  Lights facing down or up walls should be as close as possible to the wall, but you want to leave a small gap so that you don’t end up with a bright spot where the light is closest to the wall.

9. Gut-Check Lightmap Settings with a Screenshot

When rendering lightmaps in a scene make gradual adjustments to lights and bake settings; bake – adjust – repeat.  If you find a setting you like it always helps to save a screenshot of your bake settings. With this reference saved out you always have decent lighting setting to return to or use in future projects.

*Advanced Bonus: Write a script that saves and increments your settings and grabs a screenshot of the resulting render, for easy reverting with minimal user input.

10. Cut Time with Reusable Material Libraries

Material color selection window presets are super handy when setting overall color and specularity intensity on multiple materials.  Depending on your lighting you may need to decrease or increase these values.  Once you find a good color setting you can click on the little box under preset and it will save that color as a preset. You can use the dropdown tab to the right of the presets to create a new color library or load one from another scene or project. These libraries tend to be saved out to Editor/Preferences/Presets folder, but you can save them out to your own  folder within your project. 

11. Profiler Filtering

Filter the results you are seeing in the frame graph by clicking on the colored boxes underneath the respective profiler title. For example, under the “CPU Usage” profiler you can enable or disable the Rendering results by clicking on the box next to the “Rendering” sub-title. This can help you isolate exactly what causes spikes and hot spots when optimizing your project.

12. Smart Asset Searching

In Unity’s Project window, you can filter your search field quickly by typing “t:” followed by a type of asset. The asset can be Script, Scene, Texture, Material, or any other listed in the existing filter drop down. This shorthand trick has helped me find things quickly when a script has a similar name to many assets, and I just want to make a code edit!

13. Unique Names for Instantiated Objects

If you are instantiating an object via a script at runtime, give it a name in the context that you are using it even if you never need to reference the name. This helps out a lot when looking at your Hierarchy view in the editor and you forget what your objects are or where they may have come from. If nothing else, you can search for that name as a string in your project and find the place it is instantiated that much faster.

14. Stop All the Debug Logging

Unless you need specific Debug logs in your builds, it’s best to remove those statements that you use to test with before making a build for your target platform. The extra calls to Debug.Log() (as well as LogWarning() and LogError() ) eventually add up to make your build files larger, and could slow down your application if there are many of them.

15. It’s All About the Shortcuts

  • Ctrl+D – Duplicate
  • Ctrl+Shift+N – new Game Object as a child of the selected object, and set to 0,0,0
  • Ctrl+Alt+F – Move the current camera to the location and rotation of the selected object
  • Ctrl+Shift+F – Move the selected object to the location and rotation of the current camera
  • V – Hold for Vertex Snapping
  • Ctrl+P – Play the game
  • Ctrl+Shift+P – Pause Playmode
  • Ctrl+Alt+P – Step Playmode

16. Set a Custom Color for Playmode

While in playmode, any edits you make to objects will be discarded. This can be very confusing since there are times when there’s no indication the game is running. Solution – go to Preference->Colors->Playmode Tint. Make it something that stands out, like Red!

Unity is just one tool we use every day to build Egowall. What are your favorite tips to optimize development?

No Comments

Leave a Reply