Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
0
Question by Jhyatt · Aug 14, 2012 at 06:36 AM · buildbugmovingmachineseperate

Moving objects bug on game build (on other computers)

Hi everyone, I've got a bit of a head scratcher here. So in my game I have a moving object (here's the code)

function Update()

{

if(transform.position.z<=30 && Time.time) { transform.position.z+=.04; } }

It may not be top notch but it gets the job done for the most part. Anyways, when I build and run my game these objects move exactly how they should, the slowly move along the z axis until they reach 30 then stop. However, when I build the game and send it to a friend it bugs out on him and the objects immediately go to 30 on the z axis. What makes it even stranger is this happens for two people but it works just fine for my other friend. I'm not certain how to go about solving this. At one point I heard a potential solution to this problem but that was such a long time ago I can't remember where I heard it or what was the key to the solution.

I sincerely appreciate any info on this. Thanks

-Jeff Hyatt

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Loius · Aug 14, 2012 at 06:46 AM

Read that code to yourself and see if you can figure out what it means.

 as often as possible (function Update), do the following:
 if ( the transform has not passed +30 on the z axis AND ... time exists ) then
 move the transform +0.04 units along Z

I'm very guessing you want this instead:

 var metersPerSecond : float = 4;
 function Update() {
   if ( transform.position.z <= 30 ) tranform.position.z += metersPerSecond * Time.deltaTime;
 }

Different computers will run at different speeds; you have to use deltaTime to keep a consistent experience across machines.

Comment
Add comment · Show 1 · 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 Jhyatt · Aug 14, 2012 at 04:22 PM 0
Share

Thanks for the help. I had a feeling that my code really wasn't the ideal way of moving the objects, your code works great. Thank you for the clarification of what was really going on too.

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.

Follow this Question

Answers Answers and Comments

8 People are following this question.

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

Related Questions

Distribute terrain in zones 3 Answers

Objects don't move when building in flash 0 Answers

Character models disappear when project is built (SOLVED) 1 Answer

Shadows are buged for me... 1 Answer

Winapi suddenly causes problem to open game build 0 Answers


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