- Home /
Can't get this code to work
I am currently working on a splash screen but i can't get it to load the next level for some reason it doesn't get any further then fading the image and the background.
void Update () {
if (Time.time > 4)
{
Debug.Log(Time.time);
number = number - 0.01f;
image.renderer.material.SetColor("_Color", new Color(number, number, number, 1f));
gameObject.camera.backgroundColor = image.renderer.material.color;
if (Time.time > 7f) {
Debug.Log("Loading level");
Application.LoadLevel(1);
}
}
}
Is the level your trying to load in the build settings?
When you ask a question about ur code, try to add the message you get in the console window or specify that you don't get any error/warning
This code will be executed multiple times after 4s (once a frame), so this might be a problem.
yep^ so if its greater than 4{ makeafunctionforit(); }
function makeafuncvtionforit(){ and maybe waitforseconds()
} same with if greater than 7
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
I need help with scripting 0 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Attach object as child using code 1 Answer
I'm having troubles using a Capsule Cast 2 Answers