Score UI per player
I have a simple multiplayer game. Each player has a score I want to show on their screen. After my first attempt at the ui, it appears that all players are sharing a single Text component which is not good. How do I do UI that is not networked and is per player? Thanks for your time.
This question is so open ended it's very hard to answer. There are many ways to do this but for the answer to be any use we need to know what you know.
Do the players already have individual scores? I am not certain if when you say "Each player has a score I want to show on their screen." if you mean in design or actually in code you have a score for each player. Are you able to track that info already but you just need to feed it into the UI or are you not able to keep track of two scores at once yet. I think we need to know that before we can answer you about what direction to head
Answer by endlessBacon · Aug 29, 2015 at 03:17 PM
@SpaceManDan My scoring system is in place already. In my scene I have a text ui object. My player prefabs have a script attached to them for scoring that has a reference to the text object. Note that the player score is NOT a static variable, so they each have their own value. When their score changes, it updates the text of the text object. That all works until a 2nd player joins the game. At that point it appears that they are referencing the same text object even though I didn't explicitly network any of that. For my networking, I'm just using the built in stuff. Hope that helps clear it up.
Ok, looks like where you need to go with this is study up on
http://docs.unity3d.com/ScriptReference/NetworkView.html
particullarly newtworkView.observed. The answer to having each player viewing only their network view is in here.
Your answer
Follow this Question
Related Questions
Using PlayerPrefs to store string but it won't update on my UI 1 Answer
How do I make an external text document show only between certain lines in UI Text 1 Answer
Text Objects do Lerp 0 Answers
How to restrict user from typing certain numbers in input field 3 Answers
UI Text not displaying public int but will display private int 1 Answer