I’ve tried a whole load of different scripts for this but none of them seem to work. All I ever get from them is a Compiling error when I try to test them. Also if it’s possible could I get an object to appear and delay the transition to the scene so the player see’s the object for a few seconds? (Also I am a GIANT noob when it comes to scripting in unity)
using UnityEngine;
using System.Linq;
public class LoadLevelOnCollisionEnter : MonoBehaviour {
public string levelName;
public bool async;
public Collider[] collidersTriggerLoad;
void OnCollisionEnter(Collision collision) {
if(collidersTriggerLoad.Contains(collision.collider)) {
LoadLevel();
}
}
void OnTriggerEnter(Collider collider) {
if(collidersTriggerLoad.Contains(collider)) {
LoadLevel();
}
}
void LoadLevel() {
if(async) {
Application.LoadLevelAsync(levelName);
}
else {
Application.LoadLevel(levelName);
}
}
}
I think this should work.
What Zergling103 wrote seems legit, but IMO it’s better to have a centralized event manager system, like the one described in the runner tuto @ catlikecoding.com
Although that tuto is good, since you say you’re a total noob, do the first (clock) tutorial.
You can safely skip the star tutorial - that’s some stuff you won’t need for quite some time.