How to change scenes when camera enters a collider. (answerer will be rewarded)
I put a collider on the camera and I want to change a scene when a camera enters a collider. I have been trying to figure this out for a while and I want it C# please because it is only script that I know. Please keep it as simple as possible. The person who answer will be rewarded.
Answer by Monkiman300 · Aug 22, 2016 at 10:15 AM
It'll say "out of date" or some BS if you're using the newer 5x unity, but it still works as of 5.4.1f so itll work for now... Basically in C# you would:
void OnTriggerEnter (Collider entity){
if(entity.tag == "Player")
{
Application.LoadLevel ("Scene Name");
}
}
Like I said, it'll say us scene manager blah blah, but this works too
Answer by ArturoSR · Aug 22, 2016 at 02:48 AM
Hi, OK, there is only one easy way, you need to load the new level (scene), but this is important, must be hidden, that is, all the new objects or group of objects have to be disabled, with this you can toggle the visibility of it, until you load a new level.
I recommend to group all your objects from each level, this make it more easy to toggle instead one by one.
Sorry, but this is very simple, so you only need to find how to do it, if you are a noob, I recommend to read the documentation about SetActive(), DontDestroyOnLoad() and LoadLevelAdditive(), sorry to be so rude, but don't wait that any gives a full code just for a "reward" that I suppose it has to be the button on this post, I'm not fan of the "virtual rewards", I believe on hard work and hours of practical study.
you still don't understand me I'm asking how to make a scene load when a camera enters a collider.
I really understand, already give you some clues, just read, that's all, make some tests and I sure you, you will feel great when you find it, if for tomorrow night you have not found the answer, send me the code you have and I would gladly do I fix it for you, cheers.
Your answer
Follow this Question
Related Questions
Switching Cameras, Movement not working. 1 Answer
How to rotate a bone along with the camera 0 Answers
Where am i going wrong with my repeating background? 0 Answers
How would I change material properties of a box collider via script? 0 Answers
Object appears to glitch as it moves whenever the camera follows it. 0 Answers