@@ -150,6 +150,33 @@ void SetupInputField()
150150 TMP_Text text = inputField . textComponent ;
151151 TMP_Text placeholder = inputField . placeholder as TMP_Text ;
152152
153+ //ugly, fix enum
154+ TextAnchor alignment = text . verticalAlignment switch
155+ {
156+ VerticalAlignmentOptions . Top => text . horizontalAlignment switch
157+ {
158+ HorizontalAlignmentOptions . Left => TextAnchor . TextAnchorUpperLeft ,
159+ HorizontalAlignmentOptions . Center => TextAnchor . TextAnchorUpperCenter ,
160+ HorizontalAlignmentOptions . Right => TextAnchor . TextAnchorUpperRight ,
161+ _ => TextAnchor . TextAnchorUpperLeft
162+ } ,
163+ VerticalAlignmentOptions . Middle => text . horizontalAlignment switch
164+ {
165+ HorizontalAlignmentOptions . Left => TextAnchor . TextAnchorMiddleLeft ,
166+ HorizontalAlignmentOptions . Center => TextAnchor . TextAnchorMiddleCenter ,
167+ HorizontalAlignmentOptions . Right => TextAnchor . TextAnchorMiddleRight ,
168+ _ => TextAnchor . TextAnchorMiddleLeft
169+ } ,
170+ VerticalAlignmentOptions . Bottom => text . horizontalAlignment switch
171+ {
172+ HorizontalAlignmentOptions . Left => TextAnchor . TextAnchorLowerLeft ,
173+ HorizontalAlignmentOptions . Center => TextAnchor . TextAnchorLowerCenter ,
174+ HorizontalAlignmentOptions . Right => TextAnchor . TextAnchorLowerRight ,
175+ _ => TextAnchor . TextAnchorLowerLeft
176+ } ,
177+ _ => TextAnchor . TextAnchorUpperLeft
178+ } ;
179+
153180 editBox = new AndroidJavaObject ( "com.unityextensions.nativeeditbox.NativeEditBox" ) ;
154181 editBox . Call ( "Init" , name , inputField . lineType != TMP_InputField . LineType . SingleLine ) ;
155182
@@ -158,7 +185,7 @@ void SetupInputField()
158185 editBox . Call ( "SetFontSize" , Mathf . RoundToInt ( text . fontSize * text . pixelsPerUnit ) ) ;
159186 editBox . Call ( "SetFontColor" , text . color . r , text . color . g , text . color . b , text . color . a ) ;
160187 editBox . Call ( "SetPlaceholder" , placeholder . text , placeholder . color . r , placeholder . color . g , placeholder . color . b , placeholder . color . a ) ;
161- editBox . Call ( "SetTextAlignment" , ( int ) text . alignment ) ;
188+ editBox . Call ( "SetTextAlignment" , ( int ) alignment ) ;
162189 editBox . Call ( "SetInputType" , ( int ) inputField . inputType ) ;
163190 editBox . Call ( "SetKeyboardType" , ( int ) inputField . keyboardType ) ;
164191 editBox . Call ( "SetReturnButtonType" , ( int ) returnButtonType ) ;
0 commit comments