|
1 | | -In development. **Still not functional**. |
2 | | - |
3 | 1 | # CSharpProjectToUnity3dProject |
4 | | -This github action aim to turn a c# project into a Unity3d project. |
| 2 | +This github action turns a c# project into a Unity3d project. |
| 3 | + |
| 4 | +This is needed because unity doescan't use a c# project directly |
| 5 | + |
| 6 | +- A pure c# project does not have meta files for files / folders |
| 7 | +- Some files are not used by unity because it will generate them (sln, csproj) |
| 8 | + |
| 9 | +The action will open your repository looking for a `unity3d-packageConfiguration.json` and `unity3d-packageFile.json` on the root of the project |
| 10 | +It will output the `unity3d-packageFile.json` directly as a `package.json` expected by UPM and using the configuration will traverse the repositorty and create the necessary meta and asmdef files that unity will use. |
| 11 | + |
| 12 | +Sample configuration json file |
| 13 | + |
| 14 | + |
| 15 | +``` |
| 16 | +{ |
| 17 | + "AssamblyConfigurations" : [ |
| 18 | + { |
| 19 | + "Assambly": "ManualDi.Main", |
| 20 | + "AssamblyDependencies" : [ |
| 21 | + ], |
| 22 | + "Guid" : "2831785f1fa04efeb10b7d72b2e32628" |
| 23 | + } |
| 24 | + ], |
| 25 | + "IgnorePaths" : [ |
| 26 | + "[Bb]in/", |
| 27 | + "[Oo]bj/", |
| 28 | + ".git/", |
| 29 | + ".vs/", |
| 30 | + "ManualDi.Main.Tests/", |
| 31 | + "ManualDi.Main/Properties/", |
| 32 | + ".github/" |
| 33 | + ] |
| 34 | +} |
| 35 | +``` |
| 36 | + |
| 37 | +Looking at the confguration we can see |
| 38 | +- AssamblyConfigurations: Defines what will be the contents of the asmdef files |
| 39 | +- IgnorePaths: Array of string paths using the gitignore format to define what paths should be ignored |
| 40 | + |
| 41 | +## Scripts and folders |
| 42 | +The guid of the meta files will be random |
| 43 | + |
| 44 | +## Asmdef |
| 45 | +Are created when a csproj files is present. |
| 46 | +The contents of the asmdef asset file are defined on the configuration. |
| 47 | +The guid of the asmdef meta is defined on the configuration. |
| 48 | + |
| 49 | + |
| 50 | +# Running the action |
| 51 | +The action currently has 2 parameters |
| 52 | +- inputPath: defaults to the root of the repository `./` |
| 53 | +- outputPath: defaults to `./OutputUnity3dPackage/` |
| 54 | + |
| 55 | + |
| 56 | +# Example usages of this project |
| 57 | + |
| 58 | +This project is currently beeing used here https://github.com/PereViader/ManualDi.Main |
| 59 | +https://github.com/PereViader/ManualDi.Main/blob/main/.github/workflows/publish-unity3d-package.yml |
5 | 60 |
|
6 | | -Use cases for doing this: |
| 61 | +Notice the json files at the root of the repository |
7 | 62 |
|
8 | | -- Convert to unity project to later make it a package that can be imported on unity package manager using already existing actions |
| 63 | +The `publih-unity3d-package` workflow transforms the c# project and then uploads it to the same repository on a separate branch named `upm`. |
| 64 | +The branch is completely unrelated to the development branch to keep it clean. |
0 commit comments