Skip to content

Generator Overview

Watch Generator is a ScriptableObject that automates and simplifies the code generation process for custom watch types. In most cases, you only need to set it up once, and then it will function autonomously.

It can be created via Create > LiveWatch > Generator.

Screenshot_Generator

1. Auto Regen On Change

Automatically regenerates code after every change in the Schema file.

2. Output Class Name

Field for specifying your custom Watch class name.

3. Output Namespace Name

Field for your custom Watch class namespace. If left empty, no namespace will be generated.

4. Schema Class File

Reference to your Schema script in the project. This is where you can list the non-basic types you want to watch.

5. Output Class File

Reference to your custom Watch class script.

6. IsStatic

Indicates whether the generated class should be static.

7. IsPartial

Indicates whether the generated class should be partial.

8. Class Modifier

Specifies whether your Watch class will be public or internal.

9. Generate Collections Count

Determines whether Count/Length fields will be generated for collection types (Array, List, Dictionary, etc.).

10. Generate Extensions

Indicates whether extension methods will be generated. By default, this is turned off to reduce the generated file size (more details about extensions in Watch API).

11. Max Generation Depth

Defines how deep the generator will dive inside types. Avoid raising this too much as it can significantly affect performance and may lead to cyclic dependency issues.

12. Max Push Depth

Defines how deep Push methods will dive into their children. Also not recommended to raise too high for similar reasons.

13. Max Collection Size

Defines the maximum capacity for watchable collection (Array, List, Stack, etc.) members. Members exceeding this limit will be discarded. This limit does not affect other members like Count.

14. Max Dictionary Size

Same as the previous parameter but for dictionaries.

15. Generate

Triggers the generation process. This can take some time if there are many watchable types in the Schema.

16. Generate Empty

Also triggers generation, but all generated methods will be empty. This is useful if your project has compilation errors caused by the generated Watch class (e.g., after deleting some type’s member). To resolve this, you can manually delete affected parts in the generated class or use Generate Empty, ensure that the project can be recompiled, and then click Generate.


Next chapter: Usage On Device