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
2
Question by mlkielb 1 · Jun 21, 2010 at 08:02 PM · multiplayernamestatus

Multiplayer adding player names and health above each player

I'm making a 3rd person navy game where all the players are ships. In the networked version I want to make sure that each player's name show above their ship. I would prefer using GUIText so the text stays the same size no matter the range. Is there a good example out there, or can some one give me show me a little code to give me the general idea of how to do this?

Thanks.

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

5 Replies

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

Answer by Eric5h5 · Jun 21, 2010 at 08:18 PM

Use this script on the wiki.

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 Bob-The-Zealot · Jun 21, 2015 at 08:34 PM 0
Share

The links says: buy this domain.

avatar image leem919 · Oct 12, 2018 at 12:25 AM 0
Share

http://wiki.unity3d.com/index.php?title=ObjectLabel

here is the real link

avatar image
0
Best Answer

Answer by AnaRhisT · Jun 21, 2010 at 08:09 PM

Create a 3D Text and write something in the text, now correct it to the ship's head or whatever, remove the text, add to it a networkView and another script from Leepo's tutorial called NetworkRigidbody or something, make sure the obseved slot is networkRigidbody script and not something else, use PlayerPrefs function to save the name they wrote in the beginning - shown in Leepo's tutorial. Leepo's networking tutorial : http://forum.unity3d.com/viewtopic.php?t=30788

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
4

Answer by terjesorheim · Dec 11, 2012 at 02:08 PM

Try this:

 private var localName:String; // Holds the local player name
 private var namePlatePos : Vector3;
 var namePlate:GUIStyle;
 
 function OnGUI() {
         // Place the name plate where the gameObject (player prefab) is
         namePlatePos = Camera.main.WorldToScreenPoint(gameObject.transform.position);    
         GUI.Label(Rect((namePlatePos.x-50), (Screen.height - namePlatePos.y+10), 100, 50), localName, namePlate);    
     }
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 Tetrad · Jun 21, 2010 at 08:07 PM

This is going to be the key to your implementation: http://unity3d.com/support/documentation/ScriptReference/Camera.WorldToScreenPoint.html

Basically have a GUIText object point to a transform, and every frame set its position using that function. I think GUIText objects use normalized screen space (so 0-1 instead of 0-Screen.width/height), but that should just be a simple division by Screen.width/height to get the coordinates to be correct.

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 Eric5h5 · Jun 21, 2010 at 08:19 PM 0
Share

You can just use WorldToViewportPoint ins$$anonymous$$d.

avatar image
0

Answer by mlkielb 1 · Jun 21, 2010 at 08:32 PM

Awesome, thanks for all the quick responses, I will check out all the links and see what works best.

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 e-bonneville · Jun 21, 2010 at 08:41 PM 0
Share

Just letting you know, this isn't like a forum. You should make a comment on one of the answers. Good luck!

avatar image ChoMPi · Mar 23, 2014 at 01:05 PM 1
Share

It looks to me to be exactly like a forum... xD

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Multiplayer Chat Script (Problem : mixed names) 1 Answer

A name For the Character Please Help 3 Answers

Network object references to each other 1 Answer

Displaying players name above in multiplayer 1 Answer

Send last standing player name 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