Class BakeUtil
public static class BakeUtil
- Inheritance
-
BakeUtil
Fields
MaxUniqueComponentsBound
Maximum number of different components that can be created for a particular network entity. In Unity, the number of different components that will be created for a network entity is given by: (Number of different Unity Components with bindings) + (Asset Id Component) + (Unique Id Component) + (Persistent Component) + (PreserveChildren Component) The sum of all these different Components cannot surpass 31.
public const int MaxUniqueComponentsBound = 31
Field Value
bakeOnBuildKey
public const string bakeOnBuildKey = "Coherence.BakeOnBuild"
Field Value
bakeOnEnterPlayModeKey
public const string bakeOnEnterPlayModeKey = "Coherence.BakeOnEnterPlayMode"
Field Value
coherenceSyncSchemasDirtyKey
public const string coherenceSyncSchemasDirtyKey = "Coherence.CoherenceSyncSchemasDirty"
Field Value
gatherOnBakeKey
public const string gatherOnBakeKey = "Coherence.GatherOnBake"
Field Value
Properties
ActiveSchemasChanged
Determines if the active schemas have changed since the last bake performed.
note
It only takes into account schemas, it won't consider the gather manifest (necessary for a complete bake).
public static bool ActiveSchemasChanged { get; }
Property Value
BakeOnBuild
public static bool BakeOnBuild { get; set; }
Property Value
BakeOnEnterPlayMode
public static bool BakeOnEnterPlayMode { get; set; }
Property Value
CoherenceSyncSchemaOutdated
Determines if the gathered CoherenceSync schema is outdated.
public static bool CoherenceSyncSchemaOutdated { get; }
Property Value
CoherenceSyncSchemasDirty
public static bool CoherenceSyncSchemasDirty { get; }
Property Value
GatherOnBake
public static bool GatherOnBake { get; set; }
Property Value
HasReflectedModeSupport
Determines if there is reflected mode support.
public static bool HasReflectedModeSupport { get; }
Property Value
HasSchemaID
public static bool HasSchemaID { get; }
Property Value
Outdated
Determines if the baked files are outdated, based on missing files and changes on schema files. If they are, a BakeAsync() operation is recommended.
public static bool Outdated { get; }
Property Value
OutputFolder
Gets the path (relative to the project path) where the baked files are stored.
public static string OutputFolder { get; }
Property Value
SchemaID
Gets the current SchemaID for this project. The SchemaID is a hash computed from the contents of all the active schemas.
public static string SchemaID { get; }
Property Value
SchemaIDShort
Gets the current short SchemaID (5 chars) for this project. The SchemaID is a hash computed from the contents of all the active schemas.
public static string SchemaIDShort { get; }
Property Value
Methods
Bake()
Bake coherence data synchronously.
- Save Schema file for your project
- Generate optimized code for your project
public static bool Bake()
Returns
- bool
True when the Schema file and the generated code was created successfully, false otherwise.
Remarks
The end of this method will force a recompilation.
BakeAsync()
Bake coherence data asynchronously.
- Save Schema file for your project
- Generate optimized code for your project
public static Task<bool> BakeAsync()
Returns
- Task<bool>
True when the Schema file and the generated code was created successfully, false otherwise.
Remarks
The end of this method will force a recompilation.
BakeAsyncNoReturn()
Bake coherence data asynchronously with no return.
- Save Schema file for your project
- Generate optimized code for your project
public static void BakeAsyncNoReturn()
Remarks
The end of this method will force a recompilation.
EnsureSourceGeneratorIsReady<T>()
When Unity first imports the SDK (or it's reimporting all assets, or there's no Library/coherence folder), the source generator won't be able to generate the network code, since it depends on a few files that the SDK has to generate. Specifically: Library/coherence/protocol-code-generator-used.txt Library/coherence/Gathered.json When running Unity through the command line (e.g., continuous integration) without a pre-cached Library folder, ensure these files are created by calling this method. When invoked, the files will be generated and a recompile will be requested.
public static Task<bool> EnsureSourceGeneratorIsReady<T>() where T : IExecuteAfterCompilation
Returns
Type Parameters
T
Remarks
Requires Bake Mode to be set to Source Generator. Since there's a recompile involved, executing from batch mode with the -quit flag won't work.
Exceptions
- NotSupportedException
Thrown when Unity is invoked with the -quit CLI argument.
Events
OnBakeEnded
public static event Action OnBakeEnded
Event Type
OnBakeStarted
public static event Action OnBakeStarted