question

DetectivePig avatar image
DetectivePig asked

Unity Input field problem

Hi, I'm pretty new with Playfab, so I'm sorry if my question is stupid.

Not sure if the problem is with how Unity handles input fields or with Playfab Api, but I've found very strange bug.

Basically, when we write username or email in the input field in Unity and we send the registration request, in case when the input field is not long enough and we cant see, for example, the whole email on the screen, its cuts it during registration request and registers "mple@example.com" (or "example@ex" in case we rewind the input field to the beginning).

I suppose its the Playfab API problem, because it doesn't happen with the Firebase.

Best regards.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
v-humcin avatar image
v-humcin answered

The "Input Field" object in Unity has a script component called "InputField". This script has a field called "text".

The "Input Field" object also has a child object named "Text" that is used to display the text on screen. If you were to pull the text value from the display "Text" object rather than the "text" field within the "InputField" script you would get a truncated value if the text is larger than the display box.

Ensuring that you are pulling the value directly from the "InputField" script component should fix this problem. (In the inspector, the field is displayed as "Text", however when scripting it is accessed using "text"). If didn't fix the problem or you are not using the default Unity Input Field objects let me know!

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

DetectivePig avatar image DetectivePig commented ·

Hi,

I defined input field as:

[SerializeField] private InputFiel dregisterEmail;

Then I'm calling the text inside of it as:

stringemailCheck = emailText.text;

Then I'm using it inside the Register(string email) function.

0 Likes 0 ·
v-humcin avatar image v-humcin ♦ DetectivePig commented ·

Hello,

Can you clarify where you are defining "emailText"? It seems based on your setup hat you would want to change the call to:

stringemailCheck = registerEmail.text;

This should retrieve the text being stored in the InputField itself rather than display text.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.