python-adventure-game
unity documentation
[doc] - [manual] - [script references]
- Scripting in Unity
- MonoBehaviour's callbacks
- Transform - manual - script
- Transform.Rotate()
- Transform.Translate()
- Transform.position (can use this property to make a follow camera)
- Transform.rotation is a quaternion that stores the rotation of the Transform in world space.
- Script serialization and SerializeField
- Input, Input.GetAxis, Input.GetButton
- The interval in seconds from the last frame to the current one (depend on CPU computing strength): Time.deltaTime
- To make a value becomes frame independent,
value * Time.deltaTime
- To make a value becomes frame independent,
- Collider2D and Rigidbody2D (involve in Collision2D)
Rigidbody2D
put the sprite under the control of physics engine- OnTriggerEnter2D(), OnCollisionEnter2D()
- Sprites are made of pixels
- Resolution refers to the number of pixels in an image (higher resolution = more pixels)
- Unity unit
- 1 Unity unit has no meaning, just whatever we want it to represent. It could be meters, kilometers, miles, inches,...
Pixels Per Unit
- New assets default to 100 pixels per Unity unit.
- Bigger asset = less
Pixels Per Unit
- Creating a
Reference
- If we want to access / change / call anything other than this game object's transform, we need to create a reference
- We need to tell Unity what the "thing" is that we are referring to.
- Group game objects using Tags
- Creating Prefabs, and instantiating Prefabs at run time
- Spawn game objects randomly/repeatedly
- How to reference to another game objects (parent, children)?
- Cinemachine about - doc
how to add cinemachine
- Add the Package Manager window
- Find and install Cinemachine
- Add a Virtual Camera
- Point it to follow the ball
- Change the Screen X value to show more of whats to come
- Effectors 2D
- Instead of rotate object using
transform.Rotate()
, we can use Rigidbody2D's AddTorque (see alsoo angular drag, angular velocity and linear drag) - UI Canvas basic layout
show more
- UI = User Interface
- Include text, buttons, sliders, menus, etc. (user can interact with, not part of game world itself)
- UI elements live on the "Canvas"
- The canvas generally exist in "Screen Space" and is mostly separate from the game world
- You can have multiple canvases
- ScriptableObject helps to create objects that don't need to be attached to any game objects. It is most useful for assets which are only meant to store data.
- Change sprite of GameObject using Image.sprite.
- Use SceneManager.LoadScene to load specific scene (usually apply to perform replay a game).
ironpython
- IronPython and Unity. To find needed dlls, first, install IronPython. Then looking for install location on your machine:
- macos:
/Library/Frameworks/Mono.framework/Versions/Current/lib/ironpython
- window:
C:\Program Files (x86)\IronPython {version}\Lib
- macos:
- Use the dynamic keyword/.NET 4.6 feature in Unity
- The heart of IronPython and any other dynamic languages that run on .NET platform is the Dynamic Language Runtime (DLR) - overview - architecture - documentation. DLR adds a set of services on top of CLR for better supporting dynamic languages, includes
- Expression Trees
- Call site caching
- Dynamic ObjectInteroperability.