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 /
  • Help Room /
avatar image
1
Question by kuos · Nov 03, 2016 at 06:36 PM · 2d gametextsidescrollertooltip

Hovering text above enemies 2D

Context: 2D Sidescroller with some story elements

I am trying to make "floating/hovering" text boxes above enemies so players don't have to look at dialogue boxes whenever I am trying to include some context to the game story. I am not sure what the exact terminology is for this is and I have been having a difficult time looking for something that is relevant enough to what I'm going for.

An example of what I am trying to achieve is here in the Corgi Engine asset: alt text

screen-shot-2016-11-03-at-113433-am.png (174.3 kB)
Comment
Add comment · Show 2
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 TreyH · Nov 03, 2016 at 07:29 PM 0
Share

Do you already have on-screen textboxes implemented in your project, or are those needed as well?

avatar image kuos TreyH · Nov 03, 2016 at 10:26 PM 0
Share

I have on-screen dialogue textboxes yes. For now, whenever the player runs into some trigger collider it just triggers the dialogue box to read through. There should be a way to repurpose it above enemies and have it just cycle through a script of text.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by oStaiko · Nov 03, 2016 at 10:58 PM

Here's part of a script I used to make a healthbar float over objects. The script itself went on a prefab of a healthbar, which would be spawned and attached to every single game object that had health, something like this:

 hp = Instantiate(hpPrefab);
 hp.parentObject = gameObject;

 public float xDisp;  //x offset from center of parent
 public float yDisp; 
 public GameObject parentObject;  //Reference to attached object

 void Update()
 {
         Vector3 wantedPos = Camera.main.WorldToViewportPoint(parentObject.transform.position);
         transform.position = new Vector3(wantedPos.x*Screen.width + xDisp,wantedPos.y*Screen.height + yDisp,40);
 }
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

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

Related Questions

Text Mesh pro won't show certain characters 1 Answer

UI Text Editing Problem, What's Wrong? Need Anybody to Assist 1 Answer

Tooltip doesn't work 0 Answers

Tooltip on hovering certains words in textbox. 0 Answers

How to lock the camera on Y axis? 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