find out Animator parameter or current state

For parameter:

For Current State:


Event is a special kind of delegate: Step 1: declare an delegate:

Step 2: Setup the event

Step 3: Create the function

Step 4: Setup Listener

Step 5: Invoke the event

Step 5: Remove Listener


Step 1 Declare delegate:

Step 2 Instantiate:

Step 3 Create a function to be delegated:

Step 4 Assign Function to the delegate:

Step 5 Activate the Delegate:

Additional multicast: can use =+ to add more functions to the delegate. WARNING: must make sure delegate is not empty when invoking:

Setting up collider sensor to test if user enter from a single direction

The easier solution will be creating two colliders. the first collider sense the player and tell the second collider the direction is sensed. the first collider code:

for second collider

Unity3d control object movement

there are two way to control object movement: 1. By directly manipulating the transform of a object

2. By using physics Rigidbody add force

Time delay trigger for Unity3d

When player enters a collision area for a few seconds, a warning popup will appear. We create a timer called elapsedTime, using OnTriggerStay to start timer and OntriggerExit to reset the timer.

Display GUI on trigger

Using Unity New GUI system, Will first need to create a GUI element using Prefab and save under Resources Folder. Then upon collision trigger, instantiate the GUI prefab and display onGUI

Leap Motion Simulate holding of a MRT card

This script will simply add a MRT card to the first recognized right hand with a pinch motion detected. First linking the MRT card game object:

Secondly, activate leap motion, sense the pinch action and display or remose display of the mrt card.