#Sorry I pasted in the wrong thing this

1 messages · Page 1 of 1 (latest)

steel delta
#

Can you post a snippet of the code again?

#

updated code, the entire thing prefered

hybrid frost
#

you can't do .GetComponent<TMP_InputField>(); if the field you're assigning it to is declared as TextMeshProUGUI

ionic rapids
#

sorry i didnt realize it was a thread

hybrid frost
#

the types have to match.

steel delta
#

Yeah, I'm helping them.. I told them to change it to that

#

Can I see the full layout of the canvas?

slender vine
#

they need to make sure they changed the type of the amountRoundsInputTxt variable, has nothing to do with the canvas

steel delta
#

I just wanted to make sure they were accessing the right component, like inputfield and not the child

slender vine
#

that wouldn't affect the error they are receiving

steel delta
#

The error they got is due to changing something I said to

ionic rapids
#

I'm coding in norwegian so everything has norwegian names, sorry if it makes it more confusing

slender vine
#

yes and they didn't change everything they needed to. if they show the full class you'll see it

steel delta
#

Yeah, I asked for the class as well

ionic rapids
#

The whole class is in norwegian too and i had to translate the small snippet

#

but i can post it if you want?

steel delta
#

Yeah, that's fine.

slender vine
#

post your unedited code

steel delta
#

Go ahead and take over box, seems like you're very interested.

#

DM if he cant help you

ionic rapids
slender vine
#

look at line 20

ionic rapids
slender vine
#

you didn't change the variable's type

#

also you appear to have changed line 31 back to using TextMeshProUGUI for some reason

ionic rapids
slender vine
#

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