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 mlkielb 1 · Jun 22, 2010 at 05:52 PM · multiplayernetworkname

Multiplayer names problem

I am using the M2H tutorial for my multiplayer networked game. Currently I have name labels for each of the players using 3dtext ad networkview and networkrigidbody attached. I also attached a script to the 3d text that sets the value of the text to the name of the player. The code looks like this:

using UnityEngine; using System.Collections;

public class PlayerInfoText : MonoBehaviour {

public string pname=""; public float health; public Transform thetarget; public string thisName =""; private GameSetup gameSetupScript;

void Awake(){ health = 100;

}

void Start(){ if (!networkView.isMine){ gameSetupScript = GameObject.Find("Generalscripts").GetComponent<GameSetup>(); foreach (FPSPlayerNode playerInstance in gameSetupScript.playerList) { if (networkView.viewID.owner == playerInstance.networkPlayer) { pname=playerInstance.playerName; break;
} }
setName(pname); } transform.gameObject.GetComponent<TextMesh>().text = thisName +"\n" +health; }

void Update(){ transform.LookAt(transform.position + Camera.main.transform.forward);

}

When only two players are logged in (the server and 1 client). Everything works good, the names show up properly. However, when 3 or more are logged in there are problems. The server looks good, all players are labeled correctly, however, on each client all the ships have the servers name. I need all the clients to have all the correct names for the other players' ships.

Thank you.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
-1
Best Answer

Answer by AnaRhisT · Jun 22, 2010 at 06:38 PM

Use PlayerPrefs function, a WORKING example is showed in leepo's networking tutorial. folder name "Example4". - In the first scene u write a name and it saves it with playerprefs.setsting, and getstring.

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 mlkielb 1 · Jun 22, 2010 at 08:05 PM 0
Share

I've tried getting the name with PlayerPrefs.GetString("playerName"), but that just sets all the opposing players labels to the name of the localplayer.

Is there a way to access the PlayerPrefs of the other players?

avatar image mlkielb 1 · Jun 25, 2010 at 01:37 AM 0
Share

I've been going over Leepo's tutorial more and more and finally got it to work the way I needed it to.

avatar image
-1

Answer by mlkielb 1 · Jun 22, 2010 at 07:11 PM

I've tried getting the name with PlayerPrefs.GetString("playerName"), but that just sets all the opposing players labels to the name of the localplayer.

Is there a way to access the PlayerPrefs of the other players?

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 Pirate___man · Jun 22, 2010 at 07:54 PM 0
Share

When restating a question please use the comment button

avatar image AnaRhisT · Jun 22, 2010 at 08:05 PM 0
Share

Again, everything is showed there, as u can see all the names are stored in the Scoreboard with OTHER names - which is exactly like the 3D Text.

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

Networking Player Nametag 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

How to distinguish each characters in networkplay? 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