I was following a tutorial on making a basic name system that allows you to put your name into a provided text field and when done so text above your head would be changed to what you want
Tutorial Link - https://www.youtube.com/watch?v=JlKf0h0K5PU&t=1196s
My Code:
using System.Collections;
using UnityEngine;
using UnityEngine.Networking;
public class SetupLocalPlayer : NetworkBehaviour {
string pname = "player";
void OnGUI()
{
pname = GUI.TextField (new Rect (25, Screen.height - 40, 100, 30), pname);
}
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update () {
if (isLocalPlayer)
this.GetComponentInChildren.text = pname;
}
}
Error Message - "Assets/SetupLocalPlayer.cs(23,18): error CS0119: Expression denotes a `method group', where a `variable', `value' or `type' was expected"
Would really appreciate some help!
forgive me if i posted this wrong, first time posting
↧