• 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
Question by DLGScript · Aug 08, 2012 at 12:29 AM · networkingmultiplayerplayernetwork3dtext

Multiplayer|3dText PlayerName

I have a player prefab, that have playername variable. i want to "attach" the name of the player to 3dtext object that attached to the player prefab, and the "text" blank will be equal to the playername variable.

Comment

People who like this

0 Show 6
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 shobishow · Aug 08, 2012 at 03:16 AM 0
Share

Are you using C# or Javascript ? can you attach your code?

avatar image Bunny83 · Aug 08, 2012 at 03:18 AM 0
Share

@utoyo:
Don't post this as answer. I've converted it into a comment.

avatar image asafsitner · Aug 08, 2012 at 07:35 AM 0
Share

You have the 3dtext object, right? Then in it's Start() method or whatever method you use for initializing your players, you can just access it's text property and set it to the player's name, presuming you passed it via RPC beforehand.

avatar image DLGScript · Aug 08, 2012 at 08:25 AM 0
Share

i'm using JS. okay-again, i have the player prefab, then, i have in the prefab 3dtext object named "playername", and in the scense i have game object named "DirectConnectGUI" with a "connectionGUI" script. to the "connectionGUI" script, i add variable named "playername". and now i can't drag the 3dtext object (the playername object) that placed in the player prefab, to variable "playername" that placed in "DirectConnectGUI" gameobject with a "connectionGUI" script, i can't attaching it..

avatar image BeHappy · Aug 08, 2012 at 08:46 AM 0
Share

what kind of variable it is ? Playername and 3dtext....You declared them as a GameObject or GUIText in the "connnectionGUI" script??

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image

Answer by ScroodgeM · Aug 08, 2012 at 10:34 PM

//t$$anonymous$$s should be your existing line with player name stored
public string MyName;
//add t$$anonymous$$s line to same script where name stored and attach 3d text to t$$anonymous$$s in inspector
public TextMesh Text3D;
void Start()
{
    //now t$$anonymous$$s applies player name to 3d text. once. if you need to do it more times - repeat t$$anonymous$$s line wherever you need.
    Text3D.text = MyName;
}
Comment

People who like this

0 Show 18 · 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 DLGScript · Aug 09, 2012 at 01:11 AM 0
Share

i got this error:

The name 'Text3D' does not denote a valid type ('not found').

from this line:

var playername : Text3D;

avatar image fanling3 · Aug 09, 2012 at 04:57 AM 0
Share

Text3D here is a variable, you should use TextMesh instead

avatar image ScroodgeM · Aug 09, 2012 at 07:55 AM 0
Share

thanks, @fanling3

@dlgscript use

var playername : TextMesh;


avatar image DLGScript · Aug 09, 2012 at 08:11 AM 0
Share

work's, but i got little problem: when i open two exe game files on the same computer (my computer), and the first player choose his name:"player1" and the second player choose his name:"player2". the problem is that when the first player spawned (connected) to the game, his name is really "player1", but when the second player spawned (connected) to the gme, the name of those both player's are "player2"! WHY?!

avatar image ScroodgeM · Aug 18, 2012 at 09:38 PM 1
Share
  1. don't publish comments as answers.

  2. telepaths are on holiday. in your great description "doesn't works" i can't figure out an issue and resolve it.

Show more comments

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

14 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

Related Questions

Multiplayer| Attaching camera to player (if i am the owner 1 Answer

Unity networking tutorial? 6 Answers

What is the CCU of the default Unity Networking? 1 Answer

Networking Player Nametag 1 Answer

Can i make multiplayer game without unity multiplayer service ? 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