10 Unity Tips To Make Life Easier

Here are some ideas focused on testing and working in Unity. It also includes a few bonus tips.

min read

UnityParrelSync

Here are 10 random tips you might not know about, some I found on the internet and some I discovered myself.

Change the default prefab numbering system

When dealing with spawning objects, sometimes you may prefer a different numbering system (personally I prefer object_number), and from Unity 2020.0+ there is a fast way to adjust this in Unity.

Edit > Project Settings > Editor > Scroll down to ‘Game Object Naming’

Screenshot of Project Settings with prefab numbering option

ParallelSync for testing different platforms in Multiplayer

Example image of ParallelSync
Check out the docs

Parrel Sync is a cool way to make a copy of your current editor and have it sync between editors. One thing it currently does not sync though is set platforms! So maybe you decide you want a multiplayer game with web and PC versions. (This is not the most recommended way of doing this but.. for quick testing…) You can set each synced editor to a different platform type and build them out. (Can also do this to build multi-platform builds all at the same time in a crunch! 😅 Of course, you would not do that, right? You should optimize per platform.)

And Yes, Unity does warn you not to follow my advice here but hey it works. This is how I can duel build for different platforms (PC & Web in my case) and work on something else. Builds worked great with no problem 😉 This might be handy for a game jam later.

Change asset/package storage location

If you are anything like me, you find downloading a bunch of assets and packages takes up a lot of space. Perhaps also like me you prefer it on a separate SSD. Well here is a quick way to set this from the C drive to whatever drive you choose!

Edit > Preferences > Package Manager

Screenshot of Preferences with Package Manager options

Test WebGL in the browser without rebuilding (Hacky)

Did you create a web build, close it, then find you need to open it again? You will notice most likely a big red banner showing security risks doing so. What a pain! You can temporarily turn off browser security to reopen the build for more testing by using these steps. Check out the original content -> here.

Example of errors found when reopening
Common errors in Firefox
login screen example
Ideal login
Example showing how easy Firefox is to change.
Firefox is so easy to change for quick testing
Chrome screenshot example with properties screen
Chrome is slightly more work.

How to test without rebuilding

Firefox (recommended browser for running WebGL)

  1. Type about:config in the navigation bar
  2. Search for the security.fileuri.strict_origin_policy parameter
  3. Click that parameter to change it to false

Chrome

  1. Add a shortcut to Chrome on your desktop if you don’t have one
  2. Right-click the shortcut and select Properties
  3. Select the Target text box, go to the end, add a space, and add –allow-file-access-from-files
  4. It will ask you to use admin permission.
  5. Open the browser with that shortcut
  6. Select your web build and open it with Chrome.

Do you use Mac or Linux OS? Here is a solution for you.

Don’t forget to turn back on your security features!

Make objects not selectable in the editor with layers

Do you find yourself clicking on stuff you don’t mean to in the editor? Do you often find some asset in the way? Well here is a quick fix for that!

  1. Create or select a layer you want to make not selectable.
Example shows layers on object

2. Change the layer to not be selectable.

Example shows how to lock a layer

This can be really handy when dealing with environmental assets you don’t want to move etc.

Test your device with Device Simulator (Mobile)

Unity has a handy tool now that allows you to test different screen sizes, taps, and other things quickly with their device simulator tool. It’s really handy when you want to see how things look on different screen sizes.

This tweet shows a great example

Remove objects automatically in your build with tags

Don’t want something in your build? There is a tag for that, EditorOnly which will remove the object from your build. (Though if you spawn in this tagged object it will fail so use this with caution.)

Example for EditorOnly tag

Quick functions to return a random point in a sphere or circle

Dealing with math can be annoying so finding a few quick lines to solve a problem is nice.

This tweet goes into more details

Here is the code if you want to grab it.

    public static Vector2 RandomPointOnCircle(float radius)
    {
        return Random.insideUnitCircle.normalized * radius;
    }

    public static Vector3 RandomPointOnSphere (float radius)
    {
        return Random.onUnitSphere * radius;
    }

Find invisible triggers or colliders with Physics Debugger

Can’t find them? Turn on the debugger

Windows > Analysis > Physic debugger

Easy peasy

Set the camera to your viewpoint shortcut

Yes, a classic shortcut we all forget

Ctrl Shift F

Set up your view in the editor, Select your camera, and hit the magic key combo.

Want to know more shortcuts? Check them out with Edit > Shortcuts

Bonus #1 – Adjust code compiling order

This default depends on what version of Unity you use, you can further adjust it to fit your needs.

Preferences> General > Script Changes While Playing

Compiling example

Bonus #2 – Crashed? Look at backups

Every time you hit save, Unity creates a backup in your Unity temp folder (Yes this folder is found next to the Assets, Library, Project Settings folders, etc).

If you lost a lot of work, stop before you open Unity, look for this temp file.

Temp > _Backupscenes

Example backup file
If this file exists after the crash yay!

Rename this file to someName.Unity and put it in your Assets folder to use it again. It’s not a perfect solution but might be helpful in some cases.

Bonus #3 – Use V to snap and rotate

Newer versions of Unity make snapping easy, add the V tool and watch it work it’s magic.

Hold V and select the edge to either snap or rotate based on the edge of the model.

Just a quick example of the tool

Bonus #4 – Set default position for objects to enter the scene at the origin

Example origin

Now you can easily have new objects always start at 0,0,0.

Edit > Preferences > Scene View

Bonus #5 – UnityTips Website

Do you want more tips? Don’t browse Twitter much? Well, there is a website built just for tips check it out.

Leave a Reply

Your email address will not be published. Required fields are marked *

Ashley Hooper