Game Dev Notes #1 – Race Car

These are notes from the Complete C# Unity Game Developer 2D Udemy Course

Debug

Debug.Log( "Message" );
Debug message to console.

Collision

Add components:

  • [Shape] Collider (2D)
    • Play with the shape depending on what kind of collision feel you want.
  • Rigid Body
    • Turn gravity to 0 if this is not a platformer
    • Add rigid bodies to other objects if you want them to be pushed.

Scripts:

OnCollisionEnter2D
When colliding with something.

OnTriggerEnter2D
When passing through an trigger object.

Referencing Other Objects

There are a few ways to reference other objects inside scripts.

[SerializeFiled] GameObject <name>
This will create a field in the object’s inspector that you can manually select from the list. This then stores that object in the variable name you set the GameObject to.

Leave a Reply