Author Topic: Strange Behaviour from TMP_InputField  (Read 604 times)

jonc113

  • Newbie
  • *
  • Posts: 22
Strange Behaviour from TMP_InputField
« on: June 26, 2018, 09:45:01 PM »
Hi Stephan,

I finally implemented your TMP_InputField on my logon screen, but experiencing a few WEIRD things! I stripped down my project to include just my menu system and the logon prefab, (so many things won’t work if you press the wrong buttons). Attached for your review.

Using all the latest versions: Unity 1018.1.6f1 and TextMesh Pro - Release 1.2.2-2017.3

Load the only scene which is LogonTest (in Scenes folder) and run. My menu should pop up. Click "Logon" and the Logon screen should show. This is a prefab that I Instantiate from the “resources/canvases” folder, so it SHOULD be the same every time.

You will see that the Logon Field is selected (green highlight around field) and the text is empty, however the placeholder text does not show. You can type a few letters, then delete them – and THEN the placeholder text shows. Weird #1.

Now click the Back button and the menu re-appears. Click Logon again and the screen appears to be the same, and the same field is selected, but now you CAN’T type in the field. Well, you type, but nothing shows. You can select other fields and select back, but nothing. Now, click the field LogonName in the inspector and suddenly you CAN type in the field. Weird #2

I hope this is a fun challenge and not an annoying one!

Thanks for your help,

Jon Carpenter

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5619
Re: Strange Behaviour from TMP_InputField
« Reply #1 on: June 26, 2018, 11:04:41 PM »
Thank you for providing the Repro project.

I am in Europe right now for the rest of the week but will try taking a look next week once I am back.

jonc113

  • Newbie
  • *
  • Posts: 22
Re: Strange Behaviour from TMP_InputField
« Reply #2 on: June 27, 2018, 11:45:39 AM »
It's important - but no rush. Enjoy Europe!

jonc113

  • Newbie
  • *
  • Posts: 22
Re: Strange Behaviour from TMP_InputField
« Reply #3 on: July 14, 2018, 10:00:43 PM »
Back from Europe yet?

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5619
Re: Strange Behaviour from TMP_InputField
« Reply #4 on: July 15, 2018, 11:16:58 AM »
Back from Europe yet?

I am back indeed.

I'll take a look at this today.

Update
The issues appear to be related the rotation and scaling of the elements of your UI and how this confuses the UI system and the 2D RectMask.

For instance, if you disable / enable the 2D RectMask on the child Text Area object of the LogonName, the Placeholder text will show up. However, if you were to move this Placeholder text object, it would disappear again. This behavior can be observed with any UI.Text or TMP UI objects and clearly related to the 2D RectMask.

Alternatively, if you were to remove the -180 rotation on those objects, the Placeholder text would show up. Again, the 2D RectMask clearly has an issue with these rotations.

In terms of the 2nd behavior, the Input Field does receive the event but in the "weird" state after pressing back, it doesn't get the correct events. Something is confusing the event system. Perhaps some event state as you go back and forth is not getting reset. Something else is consuming the events after going back and forth.

Back to the 2D RectMask, I am not sure how it is supposed to behave with rotations so I would suggest submitting a bug report on this one to find out whether or not this is a limitation of the 2d RectMask. Alternatively, I would suggest re-working this part of your UI to avoid all these rotations.

You are also using a Canvas in World Space but without assigning the Camera to it. This could also create issues.

Your text objects all have local gradients. I would suggest creating a few Gradient Presets which you could then assign to each text objects. This would make the process of updating these gradient much easier as you would simply update the preset instead of having to change the gradient on every single text object.
« Last Edit: July 15, 2018, 04:37:31 PM by Stephan B. »

jonc113

  • Newbie
  • *
  • Posts: 22
Re: Strange Behaviour from TMP_InputField
« Reply #5 on: July 16, 2018, 05:29:15 PM »
I will take the time to reverse my game, to eliminate the 180 degree rotations and see what this fixes, then get back to you.
I will also add the camera to the canvas, as per your recommendation...

jonc113

  • Newbie
  • *
  • Posts: 22
Strange Behaviour from TMP_InputField - Still after rotations removed
« Reply #6 on: August 03, 2018, 05:18:15 PM »
Hi Stephan,

I've spent the last two weeks flipping my project around - far from trivial.
I also added the camera to the World Space canvases, per your suggestion.

The placeholder problem has been fixed - but the main problem remains - that the logon field does not work after 1st time.
BTW, you can "fix" the problem in the editor by selecting ANY field in another window, then return focus to the game.
I've attached the new project - with no rotations. Please follow the same instructions as in my first post.

This new version is also using Unity 2018.2, with the built in version of TextMeshPro

Good luck!

Jon Carpenter

jonc113

  • Newbie
  • *
  • Posts: 22
Please Help!
« Reply #7 on: August 11, 2018, 03:27:20 PM »
It's been over a week since I submitted my revised demo project.

I made all the changes you suggested - and the problem persists.

Please help!

Thanks.

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5619
Re: Please Help!
« Reply #8 on: August 11, 2018, 04:12:07 PM »
It's been over a week since I submitted my revised demo project.

I made all the changes you suggested - and the problem persists.

Please help!

Thanks.

I will try taking a look tomorrow.

jonc113

  • Newbie
  • *
  • Posts: 22
Thanks!
« Reply #9 on: August 11, 2018, 04:37:10 PM »
Please see subject

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5619
Re: Thanks!
« Reply #10 on: August 11, 2018, 04:47:17 PM »
Please see subject

What do you mean by see subject?

jonc113

  • Newbie
  • *
  • Posts: 22
Re: Strange Behaviour from TMP_InputField
« Reply #11 on: August 11, 2018, 06:11:34 PM »
I was just being silly. The subject said Thanks!

jonc113

  • Newbie
  • *
  • Posts: 22
Re: Strange Behaviour from TMP_InputField
« Reply #12 on: August 16, 2018, 09:58:16 PM »
It's been 6 more days.

Bump! (As they say)

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5619
Re: Strange Behaviour from TMP_InputField
« Reply #13 on: August 17, 2018, 12:41:19 AM »
It's been 6 more days.

Bump! (As they say)

Still trying to get there ... no matter what I'll look at this tomorrow.

I am really sorry for the delay in getting to this.

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5619
Re: Strange Behaviour from TMP_InputField
« Reply #14 on: August 18, 2018, 11:05:15 PM »
Looking at the project and reported behavior #2, the issue appears to be Event related where perhaps something in your implementation is consuming the events after going back to the first menu and back to the logon screen.