@@ -192,6 +192,33 @@ void SetupInputField()
192192 TMP_Text text = inputField . textComponent ;
193193 TMP_Text placeholder = inputField . placeholder as TMP_Text ;
194194
195+ //ugly, fix enum
196+ TextAnchor alignment = text . verticalAlignment switch
197+ {
198+ VerticalAlignmentOptions . Top => text . horizontalAlignment switch
199+ {
200+ HorizontalAlignmentOptions . Left => TextAnchor . TextAnchorUpperLeft ,
201+ HorizontalAlignmentOptions . Center => TextAnchor . TextAnchorUpperCenter ,
202+ HorizontalAlignmentOptions . Right => TextAnchor . TextAnchorUpperRight ,
203+ _ => TextAnchor . TextAnchorUpperLeft
204+ } ,
205+ VerticalAlignmentOptions . Middle => text . horizontalAlignment switch
206+ {
207+ HorizontalAlignmentOptions . Left => TextAnchor . TextAnchorMiddleLeft ,
208+ HorizontalAlignmentOptions . Center => TextAnchor . TextAnchorMiddleCenter ,
209+ HorizontalAlignmentOptions . Right => TextAnchor . TextAnchorMiddleRight ,
210+ _ => TextAnchor . TextAnchorMiddleLeft
211+ } ,
212+ VerticalAlignmentOptions . Bottom => text . horizontalAlignment switch
213+ {
214+ HorizontalAlignmentOptions . Left => TextAnchor . TextAnchorLowerLeft ,
215+ HorizontalAlignmentOptions . Center => TextAnchor . TextAnchorLowerCenter ,
216+ HorizontalAlignmentOptions . Right => TextAnchor . TextAnchorLowerRight ,
217+ _ => TextAnchor . TextAnchorLowerLeft
218+ } ,
219+ _ => TextAnchor . TextAnchorUpperLeft
220+ } ;
221+
195222 editBox = _CNativeEditBox_Init ( GetInstanceID ( ) , inputField . lineType != TMP_InputField . LineType . SingleLine ) ;
196223 _CNativeEditBox_RegisterKeyboardChangedCallback ( delegateKeyboardChanged ) ;
197224 _CNativeEditBox_RegisterTextCallbacks ( DelegateTextChanged , DelegateDidEnd , DelegateSubmitPressed ) ;
@@ -202,7 +229,7 @@ void SetupInputField()
202229 _CNativeEditBox_SetFontSize ( editBox , Mathf . RoundToInt ( text . fontSize * text . pixelsPerUnit ) ) ;
203230 _CNativeEditBox_SetFontColor ( editBox , text . color . r , text . color . g , text . color . b , text . color . a ) ;
204231 _CNativeEditBox_SetPlaceholder ( editBox , placeholder . text , placeholder . color . r , placeholder . color . g , placeholder . color . b , placeholder . color . a ) ;
205- _CNativeEditBox_SetTextAlignment ( editBox , ( int ) text . alignment ) ;
232+ _CNativeEditBox_SetTextAlignment ( editBox , ( int ) alignment ) ;
206233 _CNativeEditBox_SetInputType ( editBox , ( int ) inputField . inputType ) ;
207234 _CNativeEditBox_SetKeyboardType ( editBox , ( int ) inputField . keyboardType ) ;
208235 _CNativeEditBox_SetReturnButtonType ( editBox , ( int ) returnButtonType ) ;
0 commit comments