unity-game-engine
Why choose UnityEvent over native C# events?
Am I overlooking something? Nope, you are not overlooking anything. The only advantage and reason to use UnityEvent is that it allows you to use events in the Editor. That’s for drag and drop people or those making Editor plugins. Another advantage of UnityEvent is that it prevents the problem of Unity Object not being … Read more
How to get intellisense in Visual Studio Code for Unity functions names?
Old question, but I had the same problem just recently. There must have been an issue in your Assembly-CSharp.csproj or project-name.sln files. Most likely to be the .csproj file. If you take a look at it, you will see various references to .dll files. You can tell Unity (my version: v2019.2.20f1) to create these for … Read more
Is it possible to simplify an if-statement that checks for a combination?
You should use an enum for materials instead of string and you can use a Dictionary to hold corresponding sound combinations. You can skip multiple if statements and select corresponding object for each material automatically using the Dictionary. For example: [Flags] enum Material { Wood=1, Iron=2, Glass=4 //… } Dictionary<Material,SoundObject> sounds = new Dictionary<Material,SoundObject>(); sounds.add(Material.Wood,woodSound); … Read more
Unity Export Android 64-bit
Unity supports x64 since 2017 LTS. To enable it you can go to File > Build Settings > Player Settings. There under “Other Settings” you have to change your Script Backend to IL2CPP, and you will have the ARM64 checkbox active. Check it. And then you can either select to generate Split APKs by Target … Read more
How to Rename a Unity Project?
To change Unity project name: Change the unity project folder name (the parent folder of ‘Assets’ folder) Remove any file with .sln or .csproj suffixes under the project folder. (Unity will regenerate them) Does changing the project name change the game’s name (the name that appears on top left corner of the game window)? No! … Read more
How to set up unit tests in Unity and fix missing assembly reference error?
Try using the built-in Test Runner UI to set-up your Test Assembly Folder and first Test script. Use Window -> Test Runner -> EditMode -> “Create Test Assembly Folder”, and once you navigate to the new Test Assembly Folder, use the Create Test Script in current folder button. In particular, your Tests.asmdef is missing an … Read more
Unity game manager. Script works only one time
In every Unity project you must have A PRELOAD SCENE. It is quite confusing that Unity does not have a preload scene “built-in”. They will add this concept in the future. Fort now you have to click to add a preload scene yourself. This is the SINGLE GREATEST MISUNDERSTANDING for new programmers trying Unity! Fortunately, … Read more