{"id":22544329,"url":"https://github.com/sator-imaging/unity-altsourcegenerator","last_synced_at":"2025-07-13T20:34:29.245Z","repository":{"id":143587434,"uuid":"615592896","full_name":"sator-imaging/Unity-AltSourceGenerator","owner":"sator-imaging","description":"Ease-of-Use Source Generator Alternative for Unity","archived":false,"fork":false,"pushed_at":"2024-04-08T22:23:30.000Z","size":182,"stargazers_count":60,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T23:50:56.884Z","etag":null,"topics":["editorextension","sourcegeneration","sourcegenerator","unity","unity3d"],"latest_commit_sha":null,"homepage":"https://sator-imaging.github.io/Unity-AltSourceGenerator/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sator-imaging.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["sator-imaging"]}},"created_at":"2023-03-18T04:57:32.000Z","updated_at":"2025-01-02T09:51:21.000Z","dependencies_parsed_at":"2025-04-10T00:01:41.971Z","dependency_job_id":null,"html_url":"https://github.com/sator-imaging/Unity-AltSourceGenerator","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/sator-imaging/Unity-AltSourceGenerator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sator-imaging%2FUnity-AltSourceGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sator-imaging%2FUnity-AltSourceGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sator-imaging%2FUnity-AltSourceGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sator-imaging%2FUnity-AltSourceGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sator-imaging","download_url":"https://codeload.github.com/sator-imaging/Unity-AltSourceGenerator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sator-imaging%2FUnity-AltSourceGenerator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265200066,"owners_count":23726768,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["editorextension","sourcegeneration","sourcegenerator","unity","unity3d"],"created_at":"2024-12-07T14:06:58.060Z","updated_at":"2025-07-13T20:34:29.203Z","avatar_url":"https://github.com/sator-imaging.png","language":"C#","readme":"\u003c!-- omit in toc --\u003e\nAlternative Source Generator for Unity\n======================================\n\nAlternative Source Generator is built on the Unity native functions.\n\n- ✅ Unity Package Manager Support\n- ✅ No Complicated IDE Environment Setup\n- ✅ No Additional Package Installation\n\n\nAs you already know, Roslyn's source generator is too sophisticated. This framework provides more simple, ease of use and good enough functions for source code generation.\n\n\n\u003cp\u003e\u003cdetails lang=\"ja\" --open\u003e\u003csummary\u003e\u003csmall\u003e日本語 / JA\u003c/small\u003e\u003c/summary\u003e\n\n超簡単に使える Unity 向けソースジェネレーターです。\n\n\u003c!------- End of Details JA Tag -------\u003e\u003c/details\u003e\u003c/p\u003e\n\n\n- [🎉 USG Control Centre \u003csup\u003e\u003csub\u003e\u003csup\u003e*New*\u003c/sup\u003e\u003c/sub\u003e\u003c/sup\u003e](#usg-control-panel--window)\n  ![](https://dl.dropbox.com/scl/fi/jijclnarrruxdt590vss1/USG_Panel.png?rlkey=k44lc9swk0mmui849ck7tappk\u0026dl=0)\n- [🛠 Breaking Changes](CHANGELOG.md)\n- [✅ TODO](#todo)\n\n\n\u003cp\u003e\u003cdetails lang=\"en\" --open\u003e\u003csummary\u003e📃 Table of Contents\u003c/summary\u003e\n\n- [How to Use](#how-to-use)\n    - [Method Generator](#method-generator)\n        - [How to Generate Source Code](#how-to-generate-source-code)\n        - [Result](#result)\n    - [Self-Emit Generator](#self-emit-generator)\n        - [Result](#result-1)\n- [Output Directory and File Name](#output-directory-and-file-name)\n- [Coding Goodies](#coding-goodies)\n- [Samples](#samples)\n    - [SceneBuildIndexGenerator](#scenebuildindexgenerator)\n- [Utility Functions for Build Event](#utility-functions-for-build-event)\n- [Technical Notes](#technical-notes)\n    - [Naming Convention](#naming-convention)\n    - [`\u003cauto-generated/\u003e` Tag](#auto-generated-tag)\n- [Unity Editor Integration](#unity-editor-integration)\n    - [Installation](#installation)\n    - [USG Control Panel \\\u0026 Window](#usg-control-panel--window)\n    - [Context Menu](#context-menu)\n- [Troubleshooting](#troubleshooting)\n- [Copyright](#copyright)\n- [License](#license)\n- [Devnote](#devnote)\n    - [TODO](#todo)\n\n\u003c!------- End of Details EN Tag -------\u003e\u003c/details\u003e\u003c/p\u003e\n\n\n\n\n\nHow to Use\n==========\n\nHere is minimal implementation of source generator.\n\nSee [API Reference](https://sator-imaging.github.io/Unity-AltSourceGenerator/) for further details.\n\n\n\u003cp\u003e\u003cdetails lang=\"ja\" --open\u003e\u003csummary\u003e\u003csmall\u003e日本語 / JA\u003c/small\u003e\u003c/summary\u003e\n\n最小限のソースジェネレーターの構成はこちら。`StringBuilder` が渡されるので書き込んで `true` を返せば `context.OutputPath` に内容を書き込みます。`false` を返せば書き込みを中止できます。\n\n\u003c!------- End of Details JA Tag -------\u003e\u003c/details\u003e\u003c/p\u003e\n\n\n\n## Method Generator\n\nThis example will add `Panic()` method to target class.\n\n\u003cp\u003e\u003cdetails lang=\"ja\" --open\u003e\u003csummary\u003e\u003csmall\u003e日本語 / JA\u003c/small\u003e\u003c/summary\u003e\n\nターゲットのクラスに `Panic()` メソッドを追加するサンプル。\n\n\u003c!------- End of Details JA Tag -------\u003e\u003c/details\u003e\u003c/p\u003e\n\n\n```csharp\npublic class PanicMethodGenerator\n{\n    static string OutputFileName() =\u003e \"PanicMethod.cs\";  // -\u003e PanicMethod.\u003cTargetClass\u003e.\u003cGeneratorClass\u003e.g.cs\n\n    static bool Emit(USGContext context, StringBuilder sb)\n    {\n        if (!context.TargetClass.IsClass || context.TargetClass.IsAbstract)\n            return false;  // return false to tell USG doesn't write file.\n\n        // code generation\n        sb.Append($@\"\nnamespace {context.TargetClass.Namespace}\n{{\n    internal partial class {context.TargetClass.Name}\n    {{\n        public void Panic() =\u003e throw new System.Exception();\n    }}\n}}\n\");\n        return true;\n    }\n}\n```\n\n\n\n### How to Generate Source Code\n\n\n```csharp\nusing SatorImaging.UnitySourceGenerator;\n\nnamespace Sample\n{\n    // Add attribute to target class to use method generator.\n    // Note that class must be defined as partial class.\n    [UnitySourceGenerator(typeof(PanicMethodGenerator), OverwriteIfFileExists = false)]\n    internal partial class MethodGeneratorSample\n    {\n    }\n\n}\n```\n\n### Result\n\nGenerated code looks like this.\n\n```csharp\n// \u003cauto-generated\u003ePanicMethodGenerator\u003c/auto-generated\u003e\n\nnamespace Sample\n{\n    internal partial class MethodGeneratorSample\n    {\n        public void Panic() =\u003e throw new System.Exception();\n    }\n}\n```\n\n\n\n## Self-Emit Generator\n\nHere is target-less, self-emitting generator example.\n\nIt is useful to generate static database that cannot be generated on Unity runtime. For example, build asset GUIDs database using `UnityEditor.AssetDatabase`, resource integrity tables, etc.\n\n\n\n\n```csharp\nusing System.Text;\nusing SatorImaging.UnitySourceGenerator;\n\n[UnitySourceGenerator(OverwriteIfFileExists = false)]\nclass MinimalGenerator\n{\n    static string OutputFileName() =\u003e \"Test.cs\";  // -\u003e Test.\u003cClassName\u003e.g.cs\n\n    static bool Emit(USGContext context, StringBuilder sb)\n    {\n        // write content into passed StringBuilder.\n        sb.AppendLine($\"Asset Path: {context.AssetPath}\");\n        sb.AppendLine($\"Hello World from {typeof(MinimalGenerator)}\");\n\n        // you can modify output path. initial file name is that USG updated.\n        // NOTE: USG doesn't care the modified path is valid or not.\n        context.OutputPath += \"_MyFirstTest.txt\";\n\n        // return true to tell USG to write content into OutputPath. false to do nothing.\n        return true;\n    }\n}\n```\n\n\n\n### Result\n\n\n```csharp\n// \u003cauto-generated\u003eMinimalGenerator\u003c/auto-generated\u003e\nAsset Path: Assets/Scripts/MinimalGenerator.cs\nHello World from Sample.MinimalGenerator\n```\n\n\nOutput Directory and File Name\n==============================\n\nSource Generator creates `USG.g` folder next to target script and append class names to file name.\n\nResulting file path will be:\n\n- Assets/Scripts/\u003cb\u003eUSG.g\u003c/b\u003e/Test\u003cb\u003e.MinimalGenerator.g\u003c/b\u003e.cs\n- Assets/Scripts/\u003cb\u003eUSG.g\u003c/b\u003e/PanicMethod\u003cb\u003e.MethodGeneratorSample.PanicMethodGenerator.g\u003c/b\u003e.cs\n\n\u003cp\u003e\u003cdetails lang=\"ja\" --open\u003e\u003csummary\u003e\u003csmall\u003e日本語 / JA\u003c/small\u003e\u003c/summary\u003e\n\n書き出し先は上記の通り。フォルダーとターゲット・ジェネレータークラス名が付与されます。\n\n\u003c!------- End of Details JA Tag -------\u003e\u003c/details\u003e\u003c/p\u003e\n\n\u003e NOTE: In above example, output path is modified so that resulting file name is `Test.MinimalGenerator.g.cs_MyFirstTest.txt`\n\n\n\nCoding Goodies\n==============\n\nThere are utility methods for coding source generator more efficient and readable.\n\n- `StringBuilder` Extentions\n    - `IndentLine` / `IndentAppend`\n    - `IndentBegin` / `IndentEnd`\n    - `IndentLevel` / `IndentChar` / `IndentSize`\n- `USGFullNameOf`\n    - `usg`\n- `USGReflection` \u003csub\u003e\u003csup\u003e* can be used on Unity runtime\u003c/sup\u003e\u003c/sub\u003e\n    - `GetAllPublicInstanceFieldAndProperty`\n    - `TryGetFieldOrPropertyType`\n    - `GetEnumNamesAndValuesAsDictionary`\n    - `GetEnumNamesAndValuesAsTuple`\n\n\n```csharp\n// indent utility\nsb.IndentChar(' ');  // default\nsb.IndentSize(4);    // default\nsb.IndentLevel(3);   // template default\nsb.IndentBegin(\"void MethodName() {\");\n{\n    // cast int value to enum\n    sb.IndentLine($\"MyObject.EnumValue = ({usg\u003cMyEnum\u003e()})intValue\");\n    // --- or ---\n    string CAST_MY_ENUM = \"(\" + usg(targetTypeVar) + \")\";\n    sb.IndentLine($\"MyObject.EnumValue = {CAST_MY_ENUM}intValue\");\n}\nsb.IndentEnd(\"}\");\n```\n\n\n`usg` is a special utility that is designed for refactoring-ready source generator more readable, script template import it as a static library by default.\n\n\n\u003cp\u003e\u003cdetails lang=\"ja\" --open\u003e\u003csummary\u003e\u003csmall\u003e日本語 / JA\u003c/small\u003e\u003c/summary\u003e\n\n`System.Reflection` 系のユーティリティーと `StringBuilder` の拡張メソッド群。\n\n`usg` は特殊で、クラス名やら何やらのリファクタリングに強いジェネレーターにすると読みづらくなってしまうのを緩和するためのモノ。\n\n`{typeof(MyClass).FullName}.{nameof(MyClass.Property)}` どんどん長くなるだけなら良いけどクラス内クラスとか構造体の名前が + 付きの不正な状態で出てくる。その他にもジェネリッククラスへの対応とかなんとか、結局何かが必要になる。それならばと可能な限り短く書けるようにした。\n\nインデント系はトリッキーだけど開発機での実行なのでまあ良し。\n\n\u003c!------- End of Details JA Tag -------\u003e\u003c/details\u003e\u003c/p\u003e\n\n\n```csharp\nusing static SatorImaging.UnitySourceGenerator.USGFullNameOf;  // usg\u003cT\u003e() to work\n\n// usg\u003cT\u003e() allows to write refactoring-ready code with auto completion\nsb.Append($\"public static {usg\u003cDictionary\u003cint, float\u003e\u003e()} MyDict = new() {{ init... }};\");\n\n// usg\u003cT\u003e{params string[]) to generate full name with specified member name.\nusg\u003cMyClass\u003e(\"NestedStruct.MyField\");  // -\u003e global::Full.Namespace.To.MyClass.MyStruct.MyField\n// most strict refactoring-ready code\nusg\u003cMyClass\u003e(nameof(MyClass.NestedStruct), nameof(MyClass.NestedStruct.MyField));\n\n// usg(object valueOrType, bool isFullName) to retrieve full type definition literal\nstatic class MyClass {\n    Dictionary\u003cint, List\u003cDictionary\u003cstring, float[][]\u003e[]\u003e\u003e Complex = new(0);  // usg() throws when null\n}\nusg(MyClass.Complex);  // -\u003e global::...Dictionary\u003cint, global::...List\u003cglobal::...Dictionary\u003cstring, float[][]\u003e[]\u003e\u003e\n```\n\n\n\nSamples\n=======\n\n`SceneBuildIndexGenerator`\n--------------------------\n\nThis sample allows you to handle scene index more efficiently.\n\nTo use this sample, add `[UnitySourceGenerator(typeof(SceneBuildIndexGenerator))]` attribute to your class. after that, you can use the following enum and helper methods.\n\n\n- enum `SceneBuildIndex`\n\n    - enum consists of scene file names which registered in build settings.\n    - easy to use with Unity inspector. note that class field doesn't track build index changes.\n\n- static class `SceneBuildIndexResolver`\n\n    - `GetByName(string sceneFileNameWithoutExtension)`\n        - get build index by scene name or throws if scene is not found.\n        - this method ensures the scene must be included in build and also track build index changes.\n        ```csharp\n        // use like this in entry point to validate scene existence\n        SceneBuildIndex ImportantSceneIndex = SceneBuildIndexResolver.GetByName(\"Scene_Must_Be_Included_in_Build\");\n        ```\n\n    - `GetListByPrefix(string fileNamePrefix)`\n        - Get list of index which starts with prefix.\n\n    - `GetListByPath(string assetsPath)`\n        - Path must be started with **\"Assets/\"**.\n\n\n\nUtility Functions for Build Event\n=================================\n\nThere are utility functions to perform source code generation on build event.\n\n\u003cp\u003e\u003cdetails lang=\"ja\" --open\u003e\u003csummary\u003e\u003csmall\u003e日本語 / JA\u003c/small\u003e\u003c/summary\u003e\n\n`IPostprocessBuildWithReport` も実装しようかと思ったものの、ビルドイベントに勝手に処理追加するのはなんか訳わからんが動かんの原因だし、BuildReport として渡される全てのファイル名を走査する処理は効率も良くない。ということで。\n\n\u003c!------- End of Details JA Tag -------\u003e\u003c/details\u003e\u003c/p\u003e\n\n\n```csharp\n// generate code for specified generator type\nUSGUtility.ForceGenerateByType(typeof(MinimalGenerator));\n\n// or for the emitter type\nUSGUtility.ForceGenerateByType(typeof(ClassHasUSGAttribute));\n```\n\n\n\nTechnical Notes\n===============\n\nAs of C# 9.0, it doesn't allow to define `abstract static` methods in interface, USG reports error when source generator class doesn't implement required static methods.\n\n\u003cp\u003e\u003cdetails lang=\"ja\" --open\u003e\u003csummary\u003e\u003csmall\u003e日本語 / JA\u003c/small\u003e\u003c/summary\u003e\n\n理想はアトリビュートとインターフェイスによるフィルタリングですが、Unity 2021 は C# 9.0 で `abstract static` を含んだインターフェイスが使えません。\n\nしょうがないのでメソッドのシグネチャを確認して存在しなければエラーをコンソールに出します。\n\n\u003c!------- End of Details JA Tag -------\u003e\u003c/details\u003e\u003c/p\u003e\n\n\n![](https://dl.dropbox.com/s/kstbafbnyc54k2l/USG_IntefaceError.jpg)\n\n\n\n## Naming Convention\n\n- Generator/target class name and filename must be matched.\n- ~~Class name must be unique in whole project.~~\n- ~~Classes are ignored if defined in assembly which name starts with:~~\n    - ~~`Unity` (no trailing dot)~~\n    - ~~`System.`~~\n    - ~~`Mono.`~~\n\n\n\u003cp\u003e\u003cdetails lang=\"ja\" --open\u003e\u003csummary\u003e\u003csmall\u003e日本語 / JA\u003c/small\u003e\u003c/summary\u003e\n\n- ジェネレーター・対象クラスの名前はファイル名と一致\n- ~~ジェネレータクラスの名前はプロジェクト内で一意~~\n- ~~クラスが以下で始まる名前のアセンブリで宣言されている場合は対象としない~~\n    - ~~`Unity` (末尾ドット無し)~~\n    - ~~`System.`~~\n    - ~~`Mono.`~~\n\n\u003c!------- End of Details JA Tag -------\u003e\u003c/details\u003e\u003c/p\u003e\n\n\n\n## `\u003cauto-generated/\u003e` Tag\n\nUSG automatically adds document tag at the beginning of generated file. You can remove this document tag by `sb.Clear()` in `Emit()` method.\n\n\n\u003cp\u003e\u003cdetails lang=\"ja\" --open\u003e\u003csummary\u003e\u003csmall\u003e日本語 / JA\u003c/small\u003e\u003c/summary\u003e\n\n渡される `StringBuilder` の冒頭にはドキュメントタグが入ってます。不要なら `sb.Clear()` してください。\n\n\u003c!------- End of Details JA Tag -------\u003e\u003c/details\u003e\u003c/p\u003e\n\n\n\nUnity Editor Integration\n========================\n\n## Installation\n\nUse the following git URL in Unity Package Manager (UPM).\n\n- Latest: https://github.com/sator-imaging/Unity-AltSourceGenerator.git\n- v3.0.0: https://github.com/sator-imaging/Unity-AltSourceGenerator.git#v3.0.0\n- v2.0.1: https://github.com/sator-imaging/Unity-AltSourceGenerator.git#v2.0.1\n\n\n## USG Control Panel \u0026 Window\n\n- `Main Menu \u003e Edit \u003e Project Settings \u003e Alternative Source Generator`\n\n    ![](https://dl.dropbox.com/scl/fi/jijclnarrruxdt590vss1/USG_Panel.png?rlkey=k44lc9swk0mmui849ck7tappk\u0026dl=0)\n\n\n    - **On**\n        - Include generator in auto run sequence.\n\n    - **Run**\n        - Run generator on demand. Note that `OverwriteIfFileExists` setting on attribute is ignored.\n\n    - **Link**\n        - Click name to unveil generator script file in project window.\n        - Down arrow icon (▼) will show referencing emitters below.\n        - Linked chain icon (🔗) to unveil emitted file in `USG.g` folder.\n    - 🗑️\n        - Delete *emitted* file from `USG.g` folder.\n\n- `Main Menu \u003e Tools \u003e Alternative Source Generator`\n    - open as a window.\n\n    ![](https://dl.dropbox.com/scl/fi/dedb30699adhss8zqwft5/USG_Window.png?rlkey=13gq24ypciw00o9tkhicdpxpe\u0026dl=0)\n\n\n\n## Context Menu\n\n\u003cp\u003e\u003cdetails lang=\"ja\" --open\u003e\u003csummary\u003e\u003csmall\u003e日本語 / JA\u003c/small\u003e\u003c/summary\u003e\n\n手動でソースコード生成イベントの発火も可能です。「ジェネレーターのスクリプトファイル」か「生成されたファイル」を選択して、Project ウインドウで `Reimport` か `Unity Source Generator` 以下のメニューを実行します。\n\nジェネレーターとして参照されているファイルを Reimport した場合は、関連するクラスすべてが再生成されます。`Force Generate...` はクラスアトリビュートの設定に関わらず強制的に上書き生成します。\n\n\u003c!------- End of Details JA Tag -------\u003e\u003c/details\u003e\u003c/p\u003e\n\nThere is an ability to invoke source code generation by hand. With generator script file or generated file selected in Project window:\n\n\n- `Reimport`\n    - This command respects `OverwriteIfFileExists` setting by generator class attribute.\n    - Classes referencing selected generator will also be re-generated.\n\n- `Unity Source Generator \u003e Force Generate`\n    - This command will force re-generate source code even if overwrite setting is disabled.\n\n\n![](https://dl.dropbox.com/s/skqa6mwh932lsrg/USG_FireEvent.jpg)\n\n\n\nTroubleshooting\n===============\n\n#### Generator script update is not applied to generated file.\n\nUsually, this problem happens when Unity automatically reloads updated scripts WITHOUT Editor window getting focus. To solve the problem:\n\n1. Close Unity and Visual Studio.\n1. Restart Unity.\n1. Launch Visual Studio by double clicking `.cs` script in Unity Editor.\n\n\u003e *NOTE*: There is experimental feature to suspend auto reloading while Unity Editor in background (doesn't get focused). Open `Edit \u003e Project Settings \u003e Alternative Source Generator` to enable it.\n\n\n\n\n\nCopyright\n=========\n\nCopyright \u0026copy; 2023-2024 Sator Imaging, all rights reserved.\n\n\n\nLicense\n=======\n\n\u003cp\u003e\n\u003cdetails\u003e\n\u003csummary\u003eThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\u003c/summary\u003e\n\n```text\nMIT License\n\nCopyright (c) 2023-2024 Sator Imaging\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n\n\u003c/details\u003e\n\u003c/p\u003e\n\n\n\n\n\n\u0026nbsp;  \n\u0026nbsp;\n\n# Devnote\n\n## TODO\n\n- `GenerateOnce` attribute parameter\n    - currently USG generates same class/enum multiple times when multiple classes refer enum/singleton generator.\n    - ex. `SceneBuildIndex` must be referred only once in project to avoid conflict\n- v4: remove obsolete functions\n- support C# 11 language features (waiting for Unity 6 update!!)\n- see also: [CHANGELOG](CHANGELOG.md#unreleased)\n\n\n\u003c!-- useless\n- Add new attribute option `UseCustomWriter` to use it's own file writer instead of builtin writer. For the \"non-allocation\" addicted developers.\n    - `USGEngine.ProcessingFile()` doesn't care what happens in custom writer. just returns true in this situation.\n    - Option is for generator class. Referenced generator class doesn't have `UnitySourceGenerator` attribute so that need to retrieve it from target classes. (how handle conflicts?)\n    - `USGContext.UseCustomWriter` can be used to prevent writing file but `StringBuilder` is built prior to `Emit()` method.\n--\u003e\n\n\n\u003c!--\nClarify terminology of generator types, especially in source code comments.\ncurrently, referenced/referencing generator, or just generator, confusing!\n\n- Generator class:\n    - Class has `Emit()` method to generate code. And does NOT have `UnitySourceGenerator` attribute.\n    - current -\u003e \"referenced\" generator, \"referenced only\" generator, etc.\n\n- Target, or Emitter class:\n    - Class has `UnitySourceGenerator` attribute to invoke code generation. And does NOT have `Emit()` method.\n    - current -\u003e \"referencing\" class, just generator, etc.\n\n- Self-Emit Generator (Self-Generator) class:\n    - Class has both `Emit()` method and `UnitySourceGenerator` attribute. Works only a file. No dependencies.\n--\u003e\n","funding_links":["https://github.com/sponsors/sator-imaging"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsator-imaging%2Funity-altsourcegenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsator-imaging%2Funity-altsourcegenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsator-imaging%2Funity-altsourcegenerator/lists"}