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
4
Question by Stephanie · Apr 15, 2010 at 06:58 PM · guibuttontexttimerdisappear

GUI & GUI Text Disappear When Publishing

In the game I'm working on I have a simple GUI button to Start/exit the game, as well as a script that uses GUI Text to create a timer (it's a timed level). Both work accordingly when the game is played within Unity, however upon publishing, the timer fails to initiate and just displays "5:00" without changing, and the GUI button isn't present at all. I have cleaned out the build settings but am still having this issue. Any ideas what could be causing this? I'm at a loss.

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

6 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Ray-Pendergraph · Apr 22, 2010 at 12:52 PM

You said the timer fails to initiate. One thing that can act differently in deployed mode (particularly if debugging is turned off) is that threading and coroutine situations may create differing results in deploy vs development mode. This behavior is not specific to Unity or C# and I attribute it here to the fact that the Unity logging process is expensive enough to cause significant differences when enabled/disabled. Every time a log event is generated in Unity the stack is unwound and it does add up.

I would check your assumptions around the updating or initialization of the timer. Where is it initialized? Where is it updated? Maybe you could post the relevant code?

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
avatar image
1

Answer by martijn v · May 27, 2010 at 02:46 PM

I have a simular problem with my GUI after i published the scene. I created 2 GUI texts in the upper right corner. They are still nemed GUI text. In the script i change the text to score and the other to level. When i click play in Unity it works and when i publish it it says 2 times GUI text.

My quess is that it's in the function OnGUI() that i use.

here is the code i use

private static var Score = 0;

private static var Level = 1;

function OnGUI () { gameObject.Find ("guiLevel").guiText.text = "Level : " + Level;

guiText.guiText.text =  "Score : "+Score; 
GUI.contentColor = Color.black;

}

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 Stephanie · May 28, 2010 at 06:46 AM 0
Share

$$anonymous$$artijn, you could try rena$$anonymous$$g the GUItext within Unity rather than via a script, that will at least ensure your Score counter is not labled GUItext upon publishing. However if the script is not causing the names to change, its unlikely it will update the score either. The only way I've found to resolve this problem is to remake the entire project. It seems like something causes Unity to not deploy the script upon publishing, though it's likely not an issue with the script itself.

avatar image
0

Answer by Stephanie · May 28, 2010 at 06:46 AM

Only solution I've discovered is to rebuild the project. It's often not an issue with the script itself.

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 martijn v · May 28, 2010 at 07:38 PM 0
Share

Are you shure there isn't any other way of fixing it because then i have to rebuild a hole lot of work.

avatar image Oriek27 · Oct 23, 2010 at 04:47 PM 0
Share

thats not what he means. he means delete the published game, remove all scenes from build settings, add them again, and then build

avatar image
0

Answer by khalil · Jun 09, 2010 at 10:25 PM

Maybe you could turn all your GUI elements to independent (or parented) "Game Objects" and attach your scrips these "game objects", rather than just having "scripts" run the show. This should resolve your memory leak when you build the game.

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
avatar image
0

Answer by x4000 · Oct 06, 2010 at 04:35 PM

One thing I've found is that any assets that aren't specifically included in any scene in your project at build time won't be in your assets folder. So it could be that if you don't use the textures or similar anywhere else in your scene except programmatically instantiating it, that it's excluding the texture assets from your actual published version.

In that case, the solution is simple: just add a reference to the missing assets somewhere in your scene. That may or may not be what's going on here, but I've run into it before and thought it's worth a shot.

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
  • 1
  • 2
  • ›

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

No one has followed this question yet.

Related Questions

Help with making a triggered gui message 1 Answer

GUI Menu Display Help 2 Answers

Force Unity UI element to refresh/update? 4 Answers

GUIText Problem With MENU 1 Answer

Gui Button Solid 2 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