Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.Networking;
  3. using UnityEngine.UI;
  4. using System.Collections;
  5.  
  6. public class NTC : NetworkBehaviour {
  7.  
  8. [SyncVar]
  9. private string broadcastMessage = "textwillgohere";
  10.  
  11. public Text theText;
  12.  
  13. // Update is called once per frame
  14. void FixedUpdate () {
  15.  
  16. if (Input.GetKeyDown (KeyCode.G))
  17. {
  18. TransmitText ("It worked!");
  19. }
  20.  
  21. theText.text = broadcastMessage;
  22.  
  23. }
  24.  
  25. [Command]
  26. void CmdProvideTextToServer(string inputText)
  27. {
  28. broadcastMessage = inputText;
  29. }
  30.  
  31. [ClientCallback]
  32. void TransmitText(string inputText)
  33. {
  34. Debug.Log ("sdfsdg");
  35. CmdProvideTextToServer (inputText);
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement