This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function OnCollisionEnter(theCollision : Collision){ | |
if(theCollision.gameObject.name == "Floor"){ | |
Debug.Log("Hit the floor"); | |
}else if(theCollision.gameObject.name == "Wall"){ | |
Debug.Log("Hit the wall"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(Input.GetButtonUp("Jump")){ | |
Debug.Log("We Have Hit the Space Bar!"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can save the settings for an object and duplicate it by using a prefab. Under project in Unity, just select prefab and then drag your object on the prefab icon. And Presto, your prefab is created. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Start () { | |
Destroy(gameObject.Find("Box"), 3); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var thePrefab : GameObject; | |
function Start () { | |
var instance : GameObject = Instantiate(thePrefab, transform.position, transform.rotation); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myTimer : float = 5.0; | |
function Update () { | |
if(myTimer > 0){ | |
myTimer -= Time.deltaTime; | |
} | |
if(myTimer <= 0){ | |
Debug.Log("GAME OVER"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var speed : float = 5.0; | |
function Update () { | |
transform.Translate(Vector3(0,0,speed) * Time.deltaTime); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var power : float = 500.0; | |
function Start () { | |
rigidbody.AddForce(Vector3(0,0,power)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There's no script for this really. | |
Just select your object and change the element below the mesh renderer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Using Play One Shot | |
var myClip : AudioClip; | |
function Start () { | |
audio.PlayOneShot(myClip); | |
//Using Play Clip at point | |
var myClip : AudioClip; | |
function Start () { |
OlderNewer