Cheatography
https://cheatography.com
Common Unity 3D functions/snippets
This is a draft cheat sheet. It is a work in progress and is not finished yet.
Collisions
Discrete (default) |
Continuous |
Continuous Dynamic |
Continuous Speculative |
Checks for collisions on each physics step |
The collider is cast forward, similar to box casting. Which makes it far more accurate than Discrete |
Collides with objects that contain a rigid body (and are not static) |
Draws a bounding box around the current object, and a predicted position according to its movement |
Depends on the 'Fixed Timestep' value defined in Project Settings > Time |
The collider only collides with static objects |
Typically used when you need to collide two moving objects |
Works with both, static and dynamic colliders. But, it suffers from ghost collisions whereby an object may hit a collision prior to touching. |
|
C# Principles
(condition1 && condition2) ? true : false
|
A single line conditional statement |
public <type> <name> {get; set;}
|
Single-line property creation (prop in VS) |
public Apple(string newColor) : base(newColor)
|
This specifies the parent constructor if a constructor is not already present |
Common Code Snippets
ParentGameObject.transform.GetChild (0)
|
Get child component of GameObject |
Rigidbody.AddTorque((Vector3 torque, ForceMode mode = ForceMode.Force)
|
Continuous force along the direction of the force vector |
|