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’
ParallelSync for testing different platforms in Multiplayer
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
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.
How to test without rebuilding
Firefox (recommended browser for running WebGL)
- Type
about:config
in the navigation bar - Search for the
security.fileuri.strict_origin_policy
parameter - Click that parameter to change it to false
Chrome
- Add a shortcut to Chrome on your desktop if you don’t have one
- Right-click the shortcut and select Properties
- Select the Target text box, go to the end, add a space, and add –allow-file-access-from-files
- It will ask you to use admin permission.
- Open the browser with that shortcut
- 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!
- Create or select a layer you want to make not selectable.
2. Change the layer to not be selectable.
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.
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.)
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.
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
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
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
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.
Bonus #4 – Set default position for objects to enter the scene at the 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