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 NiscyStoy · Jun 10, 2013 at 06:20 PM · bugguitexturefloating

Floating GUITexture jumpy and buggy

Hi Folks,

I'm using this script here: http://wiki.unity3d.com/index.php?title=ObjectLabel

only modified to: [RequireComponent (typeof (GUITexture))] - mine requires: GUITexture instead of GUIText

However when i apply the script to an object on my Enemies it jumps and bugs out all over the screen when either the enemy moves or the player moves. Been trying to fix it for hours now but I can't seem to work it out, any ideas?

Cheers.

Comment
Add comment · Show 4
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 Mikez · Jun 10, 2013 at 08:23 PM 0
Share

That script is made for the camera. The reason why your labels are jumpy is because enemy position is different from camera's position. GUI elements require a camera's transform to stay in one place, or at least show properly.

Here's what i'll do:

  • Just add your code to camera.

  • Change target : Transform into a target : Transform[].

  • Add enemies to target array before runtime.

Let me know if this works for you.

avatar image Immanuel-Scholz · Jun 10, 2013 at 10:23 PM 0
Share

What makes you think the script should be applied to a camera game object?

avatar image NiscyStoy · Jun 11, 2013 at 12:54 PM 0
Share

Thanks for your comment, i will try this. However my enemies spawn during runtime and re-spawn after death so this is not possible, also i am using a click to target system as well, so i will need to work out how to achieve this if it works.

avatar image Mikez · Jun 11, 2013 at 05:06 PM 0
Share

Good point, camera is already a transform variable in code. $$anonymous$$y mistake.

You can do what Immanuel says, which is applying the script to empty transform.

1 Reply

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

Answer by Immanuel-Scholz · Jun 10, 2013 at 10:27 PM

You should apply the script component to a fresh and empty new game object or an game object only containing an GUITexture component. And not to the enemy game object himself.

The script changes the position of the game object it is attached to, so if you add it to an enemy, the script will actually move the enemy himself! (Which in turn causes your script to move the text. But the text is the same game object as your enemy, so the enemy gets moved again, and the text and the enemy and so on... causing the flickering ;)

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 NiscyStoy · Jun 11, 2013 at 12:52 PM 0
Share

Sorry, maybe i didn't explain, i have an empty gameobject with a GUiTexture applied and script. This object is a child of the enemy game object. But i will try it again tonight. James.

avatar image Immanuel-Scholz · Jun 11, 2013 at 01:30 PM 0
Share

This object is a child of the enemy game object

Then don't make it a child of the game object then ;).

The script sets the "`transform.position`" which is in world space. As the Enemy moves, this will also move the GuiTexture, which is then recalculated and set again, probably also causing flickering.

avatar image NiscyStoy · Jun 12, 2013 at 02:43 PM 0
Share

oh my... it's working, thank you for your help and the well needed after help. I feel like such an idiot now. Thank you again Immanuel, I'll mark it as the answer. James.

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

16 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

Related Questions

Mecanim Issue 0 Answers

Strange GUITexture Bug?? 0 Answers

Floating Health Bars 1 Answer

Reduce Draw call for Multiple GUI Textures with same Texture 1 Answer

Minion floating healthbar over the head 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