I am trying to make a menu in the first level that will look as if it were something akin to a patient intake form you would get at a hospital. The issue is that the text boxes move and won’t stay consistent with the writing on the image, and you have to click away in order to hit enter. Neither is desirable. Does anyone have any idea how I could fix this or know of any documentation of a similar issue?
1 Answer
1For the enter key, you can capture the event using:
if (Event.current == Event.KeyboardEvent('return'))
Debug.Log("Enter Key Hit");
As for the alignment issues, you are sizing the background texture based on the screen width. So if the Game view windows is set to “Free Aspect” your image will change size any time the game window is a different size (and therefore your TextField() calls will not align with the background image). You will either have to set a specific game size and code to that, or to use an absolute size for your texture rather than calculating the size based on the screen width/height. Note you can set a specific size by using Edit/Project Settings/Player. Then in the inspector selecting ‘Resolution and Presentation’. After setting the values Default screen width/height, it will be available in the drop down in the upper left of the frame for the game window.
It was a fantastic idea, but unfortunately, focus still needs to be reclicked onto the main game window. Haven't tried the rest yet, but I can assure you that bit did not work.
– BloodyemThank you! That did end up working, once I ran through my code visually and figured it out. Thank you so much!
– Bloodyem
Can you post your code (or a very simple subset of your code)?
– robertbu