- Home /
Major Error - Unity ninja's required !!! - Scene + Script"freezes"
Morning ninja's ( or whatever time it is wherever you live) .
I have a big problem . So Here we go ....
I have a scene . When I play it everything goes fine , it works normally how it's meant to . When the player dies a button is instantiated . When I click it , it takes me back to the menu . At the menu I press the button to load the same scene . And It just stop's working . everything apart from one script doesn't working . The only script that works is a Update on any key down translate up by 1 . 5 hours ago when I tested it. Other notes I got these errors which I can't decipher ---
-D3D device reset failed [invalid call]
-FAILED(hr)
-allocation 0x00000000 already registered @ C:/BuildAgent/work/d3d49558e4d408f4/Runtime/GfxDevice/d3d/D3D9VBO.cpp:l687 size 1048576; now calling from C:/BuildAgent/work/d3d49558e4d408f4/Runtime/GfxDevice/d3d/D3D9VBO.cpp:l687 size 1048576?
-allocation 0x00000000 already registered @ C:/BuildAgent/work/d3d49558e4d408f4/Runtime/GfxDevice/d3d/D3D9VBO.cpp:l687 size 1048576; now calling from C:/BuildAgent/work/d3d49558e4d408f4/Runtime/GfxDevice/d3d/D3D9VBO.cpp:l526 size 196560?
SUCCEEDED(hr)
FAILED(hr)
it worked perfectly have a feeling the problem is down to one of two things ------
I created a x86 64 build , after switching back to the pc platform this morning .
OR
One of these scripts
var speed = Random.Range(100,150);
function Start(){
var speed = Random.Range(100,150);
}
function Update(){
this.transform.Translate(Vector3(speed ,0,0) * Time.deltaTime);
}
var speed : float = -10;
function Update () {
this.transform.Translate(0,0,speed * Time.deltaTime);
}
Help me Obi wan Ninjobi's, your my only hope ...
How do you change scenes? $$anonymous$$y first thought is that your first script declares speed twice and might be causing some kind of issue.
may be , but it has to otherwise the update part won't work .
Answer by perchik · Feb 21, 2014 at 09:46 PM
You have to declare speed outside of the function to make update work properly, but in Start() you don't need to redeclare speed.
"var speed" creates a new variable called speed. Your first 5 lines say:
Create a global variable named speed, set it to a random range. Then create a local variable to the start function, and set it to a random range.
I doubt that this is your problem, but your script should be:
var speed;
function Start(){
speed = Random.Range(100,150);
}
function Update(){
this.transform.Translate(Vector3(speed ,0,0) * time.deltaTime);
}
Actually, now that I think about it, that very well may be the problem because of the initialization outside of a function.
Answer by Seventh Stealth · Feb 23, 2014 at 01:57 PM
GOOOD NEWS ! I FIXED MYSELF , SORRY GUYS ! THERE WAS A TIME.TIMESCALE = 0 I FORGOT TO REMVOE FROM A SCRIPT WHEN I WAS PLAYING AROUND WITH IT THE OTHER DAY . HUZZZAAAAAH !
Your answer
Follow this Question
Related Questions
I want Scene Lighting in my game. 1 Answer
I can't create a new scene??? 0 Answers
Prefab wont appear in game view but appears in scene view when called from CSV file. 2 Answers
Game Updates 1 Answer