You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/unity/en/tutorial/python2cs.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Calling C# from Python
1
+
# Calling C# from Python
2
2
3
3
> 💡 PuerTS 3.0 also supports [JavaScript](./js2cs.md) and [Lua](./lua2cs.md) calling C#, each with different syntax. Click the links to see the corresponding tutorials.
4
4
@@ -181,7 +181,7 @@ void Start() {
181
181
env.Eval(@"
182
182
exec('''
183
183
import System
184
-
import System.Collections.Generic.List__T1 as List
184
+
import System.Collections.Generic.List_1 as List
185
185
186
186
# create generic type: List<int>
187
187
ListInt = puerts.generic(List, System.Int32)
@@ -197,9 +197,9 @@ print(ls.Count) # 3
197
197
}
198
198
```
199
199
200
-
> ⚠️ **Special naming for generic types**: In C#, generic type names use backticks to indicate the number of type parameters (e.g. `` List`1 ``). In Python's `import` syntax, backticks must be replaced with `__T` followed by the count:
201
-
> -`` List`1 `` → `List__T1`
202
-
> -`` Dictionary`2 `` → `Dictionary__T2`
200
+
> ⚠️ **Special naming for generic types**: In C#, generic type names use backticks to indicate the number of type parameters (e.g. `` List`1 ``). In Python's `import` syntax, backticks must be replaced with `_` followed by the count:
201
+
> -`` List`1 `` → `List_1`
202
+
> -`` Dictionary`2 `` → `Dictionary_2`
203
203
>
204
204
> When using `puerts.load_type()`, you can use the original backtick format directly:
0 commit comments