This exports a Behaviour written in TsukimiSharp as C# that UdonSharp reads. Use it when you hand the code to an UdonSharp project, or when you submit to a place that specifies which compiler to use.
- In the Project view, select the
.cs of the Behaviour you want to export
- Choose Export as UdonSharp from the right-click menu
- Decide where to save it
| |
|---|
| What to select | The .cs of the Behaviour. If you select the paired program asset instead, the menu stays grayed out |
| What gets exported | Only the one you selected |
| Resolving type names | This uses the same range as compiling that program does. A Behaviour that refers to a type placed in another file can be exported as it is |
| |
|---|
| Where you can save it | Outside the Unity project. The save window opens on the folder one level outside the project |
| If you pick somewhere inside the project | The export stops and the reason is shown |
| Why it cannot go inside | The exported .cs is compiled by that project too, and it declares a class with the same name as the original script. The project then holds two classes of that name, and neither of them compiles |
| How the class name is decided | It comes from the file name of the original .cs, not from the name you save it under. Changing the name you save it under leaves the class name as it was |
| |
|---|
| Compiler | The exported .cs is compiled by UdonSharp. The optimization the TsukimiSharp compiler performs does not apply to the code after it is exported |
| The order of synced variables | A program built from the exported code can end up with a different order of synced variables. If the order differs, it cannot connect to instances that are still running the original program |
| Comments | The comments you wrote on declarations, and the namespace declaration, remain in the exported code |
| Temporary variables | Temporary variables the compiler created are declared together at the top of each method. The line count grows compared with the original code |
| Method names | Methods that cannot be told apart by name alone, such as those implementing an interface, get a name that includes the argument types |
| Case | What is shown |
|---|
| The original code does not compile | You are told to fix the errors in the console and try again |
| The code contains something that cannot be expressed as UdonSharp | You are told which way of writing is the reason |
In neither case is a file created.