@@ -45,7 +45,12 @@ public ContentType contentType
4545                    return  ContentType . Password ; 
4646                } 
4747
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 
4954                { 
5055                    TouchScreenKeyboardType . Default  =>  ContentType . Standard , 
5156                    TouchScreenKeyboardType . ASCIICapable  =>  ContentType . Alphanumeric , 
@@ -94,33 +99,38 @@ public bool isFocused
9499        public  int  selectionFocusPosition 
95100        { 
96101            get  {  return  input . cursorIndex ;  } 
102+ #if UNITY_2022_1_OR_NEWER 
97103            set  {  input . cursorIndex  =  value ;  } 
104+ #else
105+             set  {  input . SelectRange ( value ,  input . selectIndex ) ;  } 
106+ #endif
98107        } 
99108
100109        public  int  selectionAnchorPosition 
101110        { 
102111            get  {  return  input . selectIndex ;  } 
112+ #if UNITY_2022_1_OR_NEWER 
103113            set  {  input . selectIndex  =  value ;  } 
114+ #else
115+             set  {  input . SelectRange ( input . cursorIndex ,  value ) ;  } 
116+ #endif
104117        } 
105118
106119        public  bool  OnFocusSelectAll 
107120        { 
121+ #if UNITY_2022_1_OR_NEWER 
108122            get  {  return  input . selectAllOnFocus  ||  input . selectAllOnMouseUp ;  } 
123+ #else
124+             get  {  return  true ;  } 
125+ #endif
109126        } 
110127
111128        public  bool  EnableMobileSupport 
112129        { 
113130            get 
114131            { 
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 
119132                // return false to use unity mobile keyboard support 
120133                return  false ; 
121- #else
122-                 return  true ; 
123- #endif
124134            } 
125135        } 
126136
0 commit comments