-1

I recently started gamedev using Unity, and I've run into the weirdest problem. I can not for the life of me make my PlayerName TextMeshProUI element in my BattleHud script update to the value of the string "name".

I tried many different ways of updating, including the ways attached

derHugo
  • 83,094
  • 9
  • 75
  • 115
  • Can you please also share the code where the method "SetData()" is called. – Pavlos Mavris Jun 15 '23 at 07:06
  • 1
    **[Why should I not upload images of code/data/errors?](https://meta.stackoverflow.com/questions/285551/why-should-i-not-upload-images-of-code-data-errors)** – derHugo Jun 15 '23 at 07:17
  • also note that in all your screenshots the changes where never saved so might not even be applied and recompiled in Unity ... How have you ensured that `SetData` is being called at all and on the correct instance? -> add `Debug.Log(nameof(SetData), this);` and check if i is being logged at all and if the correct object is highlighted when clicking on it in the Unity console .. also most references are not assigned in your Inspector ... Also note: a `MonoBehaviour` already has a property `name` (the name of the `GameObject` itself) .. you could re-use it ;) – derHugo Jun 15 '23 at 07:19

1 Answers1

1

is "Setdata" function will start instantly? if this fuction will call first frame. I think this problem is (name = "text") <- this function is start after Setdata function.

BlackSperm
  • 108
  • 5