Skip to content

Random Things I've Discovered While Using Unity3D

Random Things I've Discovered While Using Unity3D
  • Editor | Inspector | Prefab | Unity

    Unable to apply changes to a Prefab

    Bycodemonkey May 20, 2022May 20, 2022

    Ever make changes to a Prefab in your Hierarchy and click in the Inspector under Overrides > Apply and nothing happens? That’s because your Prefab has at least one reference to something outside of the Prefab itself. Simply move these referenced objects/scripts inside the prefab (or delete the references to things outside of the Prefab…

    Read More Unable to apply changes to a PrefabContinue

  • Editor | SceneView | Unity

    Can’t see or select light probes

    Bycodemonkey February 3, 2022February 3, 2022

    Can’t see any light probes? Make sure your Light Probe Group is selected in the Hierarchy. Still not visible? Make sure to enable the Gizmos button in the top-right of your Scene view tab. Still not visible? Click the down arrow next to the Gizmos button and make sure the checkbox near LightProbeGroup is enabled….

    Read More Can’t see or select light probesContinue

  • Code | Unity

    Unity is mysteriously freezing / locking up

    Bycodemonkey January 27, 2022January 27, 2022

    Ever wonder why sometimes Unity may freeze (or lock up) forever, requiring you to end the process with Task Manager? Here is one reason which has bitten me many times over the years. I admit that even though I know better, I keep repeating the same mistake. Maybe it will help someone out (or future…

    Read More Unity is mysteriously freezing / locking upContinue

  • Code | Unity

    Change default C# Script template

    Bycodemonkey January 24, 2022January 24, 2022

    Ever wonder how Unity decides what a new scripts should look like when you right-click > Create > C# Script? Easy! For Windows, just go to C:\Program Files\Unity\Hub\Editor\<Unity Version>\Editor\Data\Resources\ScriptTemplates and open up 81-C# Script-NewBehaviourScript.cs.txt (as Administrator!) and edit the file to your content. Now, when you create a new C# script, it will use this…

    Read More Change default C# Script templateContinue

  • Assets | Editor | Inspector | Unity

    Asset Prefab preview image thumbnails are black, missing, outdated, or incorrect

    Bycodemonkey October 29, 2021October 29, 2021

    Are you using Universal Rendering Pipeline (URP) and some prefab previews in your Project > Assets folders are black, missing (shown as blue cubes) or not reflecting changes you made to prefabs? Just right-click on one or more prefabs and select Reimport and wait a couple seconds. If the preview images are still black, missing…

    Read More Asset Prefab preview image thumbnails are black, missing, outdated, or incorrectContinue

  • Addressables | Assets | Code | Unity

    Speeding up Addressable Assets Loading

    Bycodemonkey October 6, 2021October 24, 2021

    Are you using Addressable assets in your project? Is loading very slow, especially while pressing Play in the Editor? Make sure you are loading a list of Tasks and running them in parallel instead of individually waiting for each Task to finish. // get locations of all Addressables var locations = await Addressables.LoadResourceLocationsAsync(label).Task; // this…

    Read More Speeding up Addressable Assets LoadingContinue

  • Code | Unity

    How to use try/catch inside of a coroutine

    Bycodemonkey September 6, 2021October 24, 2021

    Ever wanted to do yield return null inside of a try/catch block but your Compiler/Editor says NOPE!? I consider this a bit of a cludge, but it does the job: private bool result = true; private void SomeMethod() { while (result) { yield return StartCoroutine(DoSomethingCo()); } } private void DoSomethingCo() { try { fileStream.Read(…); catch…

    Read More How to use try/catch inside of a coroutineContinue

  • Editor | SceneView | Unity

    How to show invisible GameObjects in the Scene View

    Bycodemonkey August 14, 2021October 24, 2021

    Are you tired of seeing nothing when you click on a GameObject in your scene? First, find your GameObject and click the 3D cube on the left side: If you change it to e.g. a blue diamond: Now in the Scene view it will appear as a blue diamond:

    Read More How to show invisible GameObjects in the Scene ViewContinue

  • Editor | Inspector | Unity

    How to show private variables in the Inspector

    Bycodemonkey August 14, 2021October 24, 2021

    Click the 3 dot menu in the upper-right corner of any GameObject in the Inspector and click Debug: Afterwards you can see a lot more information about your scripts, including private variables:   Alternately, if you have the amazing NaughtyAttributes package in your project, you can use [ShowNonSerializedField] attribute: [ShowNonSerializedField]private float myHiddenVariable = 1f;

    Read More How to show private variables in the InspectorContinue

  • Code | Unity

    Don’t compare floats or Vector3 variables directly

    Bycodemonkey August 14, 2021October 24, 2021

    Since the float implementation in Unity is built for performance and not accuracy (which is why in the Editor you will often see weird values like 0.000000001 instead of 0), you should never compare float values with the equality operator such as: if (floatVar == 0.5f) { … } …otherwise the result will most likely…

    Read More Don’t compare floats or Vector3 variables directlyContinue

Page navigation

1 2 Next PageNext
Scroll to top
  • Privacy Policy