|
Post by Red Moon Entertainment on Apr 16, 2017 17:27:19 GMT
I tried many but I'm not able to make work both scripts to load scene after time or to switch camera after time. Can you please help me I really need them.
|
|
|
Post by Power Supersport on Apr 18, 2017 17:53:47 GMT
There is a variable called Time.deltaTime which is simply the time between each frame... To create a timer, just have a float increment by Time.deltaTime...
So, in your case it would look something like this...
float time = 0; bool camSwitched = false;
void Update () {
time += Time.deltaTime; // time is in seconds if ((time > 5) && (!camSwitched)) { // Switch to a camera or switch scene camSwitched = true; }
}
To change the scene you need to use:
SceneManager.LoadScene (string name); To change the camera you can use:
Cam1.SetActive (true); Cam2.SetActive (false); Where Cam1 and Cam2 are GameObject-s...
|
|
|
Post by Red Moon Entertainment on Apr 18, 2017 19:13:42 GMT
Thank you very very very very much. You're saving me and my game!
Where to put exactly the last two scripts-pieces?
|
|
|
Post by Power Supersport on Apr 18, 2017 19:30:08 GMT
At the place where I commented "Switch to a camera or a scene"...
|
|
|
Post by Red Moon Entertainment on Apr 18, 2017 19:48:09 GMT
Oh, yeah. Thx
It gives me an error using SceneManager. Basicly, it says that it doesn't exist.
|
|
|
Post by Power Supersport on Apr 18, 2017 20:33:38 GMT
You need to add that in the beginning of your script...
using UnityEngine.SceneManagement;
|
|