This is my first script Im trying to make and Im know thats its wrong but can someone tell me whats Im doing wrong?
I want a animation and sound play when hitting a GameObject
Script
var; GameObject (GameObject)
if GameObject “GameObject” Colide with (GameObject)
Play ;animation “stop”
Play ;audio “stop”
appels
2
is this java ?
you should be having something like :
var myObject : Transform;
function Update()
{
your code here
}
Hey yeah sry its java ^^ , do you mean something like this
var myObject : Transform;
var animation
var audio
function Update()
{
//your code here
if ;GameObject “GameObject” Collide with (GameObject)
Play ;animation “stop”
Play ;audio “stop”
}
still need help 
If you’re using a CharacterController, you can detect collisions using the OnControllerColliderHit function:-
function OnControllerColliderHit (hit : ControllerColliderHit) {
audio.Play();
}
If it’s a rigidbody object (ie, controlled by physics), you can get the collision with OnCollisionEnter:-
function OnCollisionEnter(collision : Collision) {
audio.Play();
}