Unity
Created: 2021-03-27 09:16:15 -0700 Modified: 2021-08-02 20:13:06 -0700
Setup
Section titled Setup- Using Visual Studio (reference): go to Edit → Preferences → External Tools → set the external script editor. After that, close Visual Studio and reopen it from Unity by double-clicking a script. You should get proper Intellisense then.
Basics
Section titled Basics- Make a prefab: just drag an object from the Hierarchy into the Project at the bottom.
- Destroy a game object: in a script, “Destroy(this)” will destroy the script itself, so you want “Destroy(this.gameObject)” (or just “gameObject” for short).
- Physics and layers: you can modify the layer of any GameObject at the upper right of the Inspector. Then, in Edit → Project Settings… → Physics or Physics2D → Layer Collision Matrix
Quick reference
Section titled Quick reference- Print something out: use print, Debug.Log, or Debug.LogFormat.
Shortcuts
Section titled Shortcuts- Ctrl+P: stop/play game
Particle systems
Section titled Particle systems- Applying physics to the particles (reference):
- In the Inspector, check the Collision box, set the Type to World and change the mode if you’re in 2D.
Troubleshooting
Section titled TroubleshootingVisual Studio Editor Package version 2.0.11 is available, we strongly encourage you to update from the Unity Package Manager for a better Visual Studio integration
Section titled Visual Studio Editor Package version 2.0.11 is available, we strongly encourage you to update from the Unity Package Manager for a better Visual Studio integrationWindow → Package Manager → Type “Visual Studio Editor” → Click “Update”