how do i make it so when a ball hits a specific cube it loads the next level and the ball has no tag how would this be done?
Well first is the cube that you’re running into a trigger or not?
If it’s not a trigger you can just use:
function OnCollisionEnter(collision:Collision){
//checking the name of the collided object
if (collision.transform.name=="NameofObjectCollidingWith")
{
//loading the new level
Application.LoadLevel("NameofLevel");
}
}
What’s happening is that when the cube collides with another collider this function is called once. Then it’s checking the name of the collided object with the code “collision.transform.name”. And then you would load the new level with “Application.LoadLevel(()”.
Attach the above script to your cube object that your ball is going to run into (it’s in unity javascript). Make sure to replace the names with the name of your ball object and the name of the new level to be loaded.
You also need to attach a rigidbody to the cube, so the function will trigger. I’d recommend setting the rigidbody to kinematic unless you want it to be affected by physics.