Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by Andrew 1 · Jan 29, 2010 at 05:02 AM · rotationeditorbuild

Builds differ from editor

I've got a strange issue with unity. I know similar topics have been posted, but I've scoured the forums, answers, and the unity web page for an answer without success.

Everything works properly in the editor... but for some reason I can't get the following code to work in standalone or web:

var spinnerBox = GameObject.FindWithTag("spinnerBox");
spinnerBox.transform.Rotate(0, 10, 0);

This script is applied to a game object with one child, designated "spinnerBox" as its tag. In the editor, it spins, in standalone, it does nothing. I've also tried to use:

var spinnerTrans = transform.Find("<object name>");
spinnerTrans.Rotate(0, 10, 0);

...which has the exact same effect.

I'm very impressed with unity's feature set so far and I'd really love to continue developing with it, but this issue is killing me. Thanks for any help in advance!

-Andrew

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

4 Replies

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

Answer by Eric5h5 · Jan 29, 2010 at 05:38 AM

If this is in Update, then you want

spinnerBox.transform.Rotate(0.0, 10.0 * Time.deltaTime, 0.0);

because otherwise it's framerate-dependent. Although it would be better to do

spinnerBox.transform.Rotate(0.0, spinSpeed * Time.deltaTime, 0.0);

and set up the appropriate variable, so you can easily change the speed.

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 Andrew 1 · Jan 29, 2010 at 06:04 AM 0
Share

Yes, I am aware of this. The issue isn't how the script behaves, it's that it behaves completely differently in different builds (and nothing to do with time).

avatar image
1

Answer by Horsman · Jan 29, 2010 at 01:38 PM

The main difference that shows up between builds and the editor is the order in which scripts are executed.

I would check very carefully that your awake and start calls are executing in the order you think they should. If indeed it is exactly what you've posted above that isn't working, I don't see anything wrong.

Comment
Add comment · Show 3 · 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 Andrew 1 · Jan 29, 2010 at 10:18 PM 0
Share

I'm not using any Start() or Awake() functions at all, so that can't be the issue.

I was playing with it today, and discovered that a rotate script I created earlier does work (in both the editor and the web player). So I duplicated the script into a new JS file and applied it to the SA$$anonymous$$E object (after removing the previous script from it), and it no longer works in the web player (but still works in the engine). Words cannot describe my frustration.

avatar image Jaap Kreijkamp · Jan 30, 2010 at 01:42 AM 0
Share

Sounds frustrating indeed, but have you tried adding some debug statements and look in the output log? Do you have the same problem when you make a standalone build ins$$anonymous$$d of a web build?

avatar image Andrew 1 · Jan 30, 2010 at 08:15 PM 0
Share

I already posted that I checked the logs and there are no errors. When I build a standalone, there are $$anonymous$$ORE weird issues, but mostly with ti$$anonymous$$g (and yes, I know how to properly implement time with delta). I'm pretty sure this isn't an improperly implemented script... I reiterate that the SA$$anonymous$$E script works, but when duplicated into a new .js file and applied to the same object, it doesn't.

avatar image
0

Answer by Jaap Kreijkamp · Jan 29, 2010 at 06:07 AM

Have you looked in the output log when running the game? Except indeed what Eric5h5 says I can't see anything wrong directly but it's hard to say much from two lines of code. If the spinnerbox can't be found, there should have been an exception and this is written in the output log.

If the code is from the update function, it's quite expensive to do a find every update. Better make a global variable and do the find part in the Start function or instead of a find.

Comment
Add comment · 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 Andrew 1 · Jan 29, 2010 at 06:18 AM 0
Share

Thank you, but again, I'm aware of these things. I'm trying to keep it as simple as possible to be clear where the problem lies.

Either the Find() or the FindWithTag() function (or both) are not functioning in web or standalone releases, but appear to work just fine in the editor. I don't have any errors in my logs. Any idea why this could be?

avatar image Andrew 1 · Jan 29, 2010 at 06:30 AM 0
Share

...and yes, it is happening in Update().

avatar image
0
Wiki

Answer by Anthony Paul · Jun 19, 2010 at 12:51 AM

I'm having the exact same problem.

I posted it here: http://forum.unity3d.com/viewtopic.php?t=55264

It seems that my build code will not work with any new .js scripts I create. Once I've copied an pasted in tutorials work fine. Anything I do in the editor also works in the editor (but exclusively in the editor) this is not limited to transformations but to sounds, destroying objects etc.

Does anyone have an answer to what's going on?

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

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Distribute terrain in zones 3 Answers

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Access to final assemblies before they put in build 1 Answer

Loading screen works fine in Unity Editor, but gets stuck in the finished/built .exe version? 0 Answers

Who owns NetworkViews placed in the editor? 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