This github action turns a c# project into a Unity3d project.
This is needed because unity can't use a classic c# project directly, it needs the meta files and an assembly configuration.
- A pure c# project does not have meta files for files / folders
- Some files are not used by unity because they are ignored or generated by unity (sln, csproj)
The action will open your repository looking for a unity3d-packageConfiguration.json
and unity3d-packageFile.json
on the root of the project.
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.
Sample unity3d-packageConfiguration.json
file:
{
"AssamblyConfigurations" : [
{
"Assambly": "ManualDi.Main",
"AssamblyDependencies" : [
],
"Guid" : "2831785f1fa04efeb10b7d72b2e32628"
}
],
"IgnorePaths" : [
"[Bb]in/",
"[Oo]bj/",
".git/",
".vs/",
"ManualDi.Main.Tests/",
"ManualDi.Main/Properties/",
".github/"
]
}
Looking at the confguration we can see
AssamblyConfigurations
: Defines what will be the contents of the asmdef filesIgnorePaths
: Array of string paths using the gitignore format to define what paths should be ignored
The guid of the meta files will be random
Are created when a csproj files is present. The contents of the asmdef asset file are defined on the configuration. The guid of the asmdef meta is defined on the configuration.
The action currently has 2 parameters
inputPath
: defaults to the root of the repository./
outputPath
: defaults to./OutputUnity3dPackage/
This project is currently beeing used in PereViader/ManualDi.Main
Notice the json files at the root of the repository
The publih-unity3d-package
workflow transforms the c# project and then uploads it to the same repository on a separate branch named upm
.
The branch is completely unrelated to the development branch to keep it clean