@@ -45,7 +45,12 @@ public ContentType contentType
45
45
return ContentType . Password ;
46
46
}
47
47
48
- return input . keyboardType switch
48
+ #if UNITY_2022_1_OR_NEWER
49
+ var keyboardType = input . keyboardType ;
50
+ #else
51
+ var keyboardType = TouchScreenKeyboardType . Default ;
52
+ #endif
53
+ return keyboardType switch
49
54
{
50
55
TouchScreenKeyboardType . Default => ContentType . Standard ,
51
56
TouchScreenKeyboardType . ASCIICapable => ContentType . Alphanumeric ,
@@ -94,33 +99,38 @@ public bool isFocused
94
99
public int selectionFocusPosition
95
100
{
96
101
get { return input . cursorIndex ; }
102
+ #if UNITY_2022_1_OR_NEWER
97
103
set { input . cursorIndex = value ; }
104
+ #else
105
+ set { input . SelectRange ( value , input . selectIndex ) ; }
106
+ #endif
98
107
}
99
108
100
109
public int selectionAnchorPosition
101
110
{
102
111
get { return input . selectIndex ; }
112
+ #if UNITY_2022_1_OR_NEWER
103
113
set { input . selectIndex = value ; }
114
+ #else
115
+ set { input . SelectRange ( input . cursorIndex , value ) ; }
116
+ #endif
104
117
}
105
118
106
119
public bool OnFocusSelectAll
107
120
{
121
+ #if UNITY_2022_1_OR_NEWER
108
122
get { return input . selectAllOnFocus || input . selectAllOnMouseUp ; }
123
+ #else
124
+ get { return true ; }
125
+ #endif
109
126
}
110
127
111
128
public bool EnableMobileSupport
112
129
{
113
130
get
114
131
{
115
- // 2022.1.0f1
116
- // https://unity.com/ja/releases/editor/whats-new/2022.1.0#release-notes
117
- // WebGL: Added mobile keyboard support for WebGL to enter text in UI input fields.
118
- #if UNITY_2022_1_OR_NEWER
119
132
// return false to use unity mobile keyboard support
120
133
return false ;
121
- #else
122
- return true ;
123
- #endif
124
134
}
125
135
}
126
136
0 commit comments