-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Codegen Results
Your code is now ready for use! But, as with other code generation systems, there are caveats:
Manual changes to generated code will be lost the next time the code generator is run. If you need to augment the output of a code generator, consider making a new one.
Generated code exists as plain text files and is thus safe for storage in any version control system. However, the previous warnings about manual changes still hold, thus complicating merge conflicts. We see two main workflows for handling this:
This is the simplest option, and may be sufficient for solo projects. As a consequence, small changes to your code (such as introducing a handful of components) can result in disproportionately large commits, especially if your project uses Unity and its .meta
file system.
For this workflow, you would not track generated source code; instead, you would expect everyone on your team to be able to generate a local copy at will, as they would for compiled binaries. This is the best option in the long run, but if you're using the commercial version of Entitas then every member on your team will need a license. Additionally, if your project is open source then this workflow may hinder user's ability to contribute (since you may have to help them set up Entitas and Jenny).
Jenny usually generates a large number of files. If your project uses Unity, double this to account for .meta
files. If your development environment scans your code base in real time (e.g. for autocomplete or diagnostics), the sheer number of generated files may slow down or break certain features.
MonoBehaviour
s and other Unity assets deserve special mention. For every asset (source file, texture, etc.) in your project, Unity generates a corresponding .meta
file containing metadata. This .meta
file assigns a randomly-generated GUID to its corresponding asset for the purpose of declaring relationships between assets. If a file is deleted outside of Unity but then re-added, it will have a different GUID, and all references to it in other assets (e.g. prefabs or animations) will be lost. For this reason, if you use custom code generators to generate MonoBehaviour
s, you must take extra steps to ensure that their .meta
files are preserved between generations. You will need to write a custom plugin for this.
Guides: Introduction - Installation - Upgrading - FAQ - Cookbook - Contributing
Need Help? Ask a question on Discord or create an issue.
- The Basics
- Concepts
- Architecture / Patterns