I've added this code to try to change the level when the character enters the trigger but it isn't working for some reason. I've got a box collider set to is trigger and added a rigidbody. using UnityEngine; using System.Collections; public class Leveltrigger : MonoBehaviour { void OnTriggerEnter(Collider other) { Application.LoadLevel(2); } } Any help would be great Thanks
Try to use Debug.Log(other.gameObject.name); and see if it returns the name of your Character. Also, I am sure you are aware that leves, are zero based. If you set the loading level to "2", the third level is going to be called.
Hi I'm not sure how to use the Debug Log but are there any mistakes that are glaringly obvious that I'm not seeing as I'm very new to coding and I can't see what I'm doing wrong really. Thanks
2d or 3d game ? If you have colliders2D, then line should be void OnTriggerEnter2D (Collider2D other) and perhaps, it is better if trigger works only with player. Make tag of you player Player. The trigger itself dont need rigidbody2d, only player. using UnityEngine; using System.Collections; public class Leveltrigger : MonoBehaviour { void OnTriggerEnter2D (Collider2D other) { if (other.gameObject.tag == "Player") Application.LoadLevel(2); } } at last open build settings, and check, that your scene is added to scenes in build and look what number have the scene. I hope, you didnot forget add script to trigger. and if 3d, than i dont know
Code (csharp): Application.LoadLevel("SceneName"); This is a much safer way to call the scene you wish to load.