• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by Seventh Stealth · Feb 21, 2014 at 09:28 PM · scenegameupdate

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 ...

Comment

People who like this

0 Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image perchik · Feb 21, 2014 at 09:31 PM 1
Share

How do you change scenes? My first thought is that your first script declares speed twice and might be causing some kind of issue.

avatar image CoalCzar · Feb 21, 2014 at 09:34 PM 0
Share
  • to declaring "speed" twice

avatar image Seventh Stealth · Feb 21, 2014 at 09:35 PM 0
Share

may be , but it has to otherwise the update part won't work .

2 Replies

· Add your reply
  • Sort: 
avatar image

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.

Comment

People who like this

0 Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Seventh Stealth · Feb 22, 2014 at 10:29 AM 0
Share

I'll give it a go

avatar image Seventh Stealth · Feb 22, 2014 at 10:35 AM 0
Share

didn't change anything

avatar image

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 !

Comment

People who like this

0 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

I want Scene Lighting in my game. 1 Answer

Would like a function to change a parameter once, after an "if" statement has been met. 1 Answer

Making a Pc game, problem occurs with build. When running the game from desktop, Character flashilight does not work, no errors whatsoever. 0 Answers

OnTriggerEnter not firing in game view 0 Answers

Make ray follow mouse position from player origin (Isometric) 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges