• Unity

Filed under:
Research > Gamedev

Notes on the Unity game engine.

Basic Concepts

Triggers

Triggers are a special kind of Collider. They do not block movement, but the Physics System still checks if the character will collide with them. It sends you a message when your character enters a Trigger, so you can handle that event.

Fixed Update vs Update

You need to use this to make updates that are oriented around time rather than frame rate. I think.

FixedUpdate should be used when applying forces, torques, or other physics-related functions - because you know it will be executed exactly in sync with the physics engine itself.

Animation

  • the animator component is used to play animations.

  • the "controller" is the most important part of the animator component: > A Controller is the component responsible for choosing which animation to play, based on rules you will define (for example, making the character go from standing to a running animation when their speed is greater than 0). > The Controller defines how the animations are related, as in how to go from one animation to another.

Instantiate

Instantiate takes an object as the first parameter and creates a copy at the position in the second parameter, with the rotation in the third parameter.

Quarternions

Quaternions are mathematical operators that can express rotation, but all you need to remember here is that Quaternion.identity means "no rotation".

Layers

Layers allow you to group GameObjects together so they can be filtered.

Example: spawning a projectile where a player is when using a physics system would cause them to both immediately collide. By using layers you can tell the physics system that two entities (character and projectile) cannot collide.

Layers are defined in the inspector. You can add / manage them there. Unity already uses a few layers; they cannot be changed.

You may need to change the Layer Collision Matrix Under Edit > Project Settings > Physics 2D to determine which layers collide with which.

Cameras

Cinemachine seems to be a recommmended camera.

Blender :: Unity

Use .fpx

  • Before importing your model, be sure to back it up in your scene.

  • You'll likely want to join your scene's sub objects into a single object.

  • Export as a .fpx file.

  • When you export, check selected objects to only export the selected items.

  • Materials in Unity can be applied to items on the fpx.

Use the blender file itself

  • Save the blender file itself to your unity project itself.

  • Unity will import for you.

  • Con: everyone will have to have blender for it to work.

  • Pro: if you make changes in Blender, Unity will live update when you make changes in Blender.

  • You have to create it as a prefab yourself;

    • Drag the blender grouped tree item into your prefab;

    • Then drag the specific items you want from the scene in as there own prefab.