#Sorry I pasted in the wrong thing this
1 messages · Page 1 of 1 (latest)
you can't do .GetComponent<TMP_InputField>(); if the field you're assigning it to is declared as TextMeshProUGUI
the types have to match.
Yeah, I'm helping them.. I told them to change it to that
Can I see the full layout of the canvas?
they need to make sure they changed the type of the amountRoundsInputTxt variable, has nothing to do with the canvas
I just wanted to make sure they were accessing the right component, like inputfield and not the child
that wouldn't affect the error they are receiving
The error they got is due to changing something I said to
I'm coding in norwegian so everything has norwegian names, sorry if it makes it more confusing
yes and they didn't change everything they needed to. if they show the full class you'll see it
Yeah, I asked for the class as well
The whole class is in norwegian too and i had to translate the small snippet
but i can post it if you want?
Yeah, that's fine.
post your unedited code
Go ahead and take over box, seems like you're very interested.
DM if he cant help you
look at line 20
thanku:)
you didn't change the variable's type
also you appear to have changed line 31 back to using TextMeshProUGUI for some reason
After changing it all to TMP_InputField i get this message when clicking at the start game button
NullReferenceException: Object reference not set to an instance of an object
KronOgMynt.GameStart () (at Assets/_scripts/KronOgMynt.cs:143)
if the GameObject that the TMP_InputField is attached to isn't called "AntallRunderTxt" then it won't be able to find it properly.
It's best to avoid GameObject.Find when possible anyway because it's slow and can lead to issues like this. Here are several better ways to get a reference to an object: https://www.youtube.com/watch?v=Ba7ybBDhrY4
(also looking back at your previous screenshot, you don't have any objects named AntallRunderTxt so that find call wouldn't work for any object anyway