Class representing a table of network prefabs. More...
Public Member Functions | |
int | AddInstance (NetworkPrefabId prefabId) |
Add an instance of a prefab id. More... | |
NetworkPrefabId | AddSource (INetworkPrefabSource source) |
Adds a prefab source to the table. More... | |
void | Clear () |
Clear the prefab table. More... | |
bool | Contains (NetworkPrefabId prefabId) |
Returns true if the prefab table contains a prefab with the given id. More... | |
IEnumerable<(NetworkPrefabId, INetworkPrefabSource)> | GetEntries () |
Returns all entries in the table. More... | |
NetworkObjectGuid | GetGuid (NetworkPrefabId prefabId) |
Gets a prefab guid by id. More... | |
NetworkPrefabId | GetId (NetworkObjectGuid guid) |
Gets a prefab id by guid. More... | |
int | GetInstancesCount (NetworkPrefabId prefabId) |
Get the instance count of a prefab id. More... | |
INetworkPrefabSource | GetSource (NetworkObjectGuid guid) |
Gets a prefab source by guid. More... | |
INetworkPrefabSource | GetSource (NetworkPrefabId prefabId) |
Gets a prefab source by id. More... | |
bool | IsAcquired (NetworkPrefabId prefabId) |
Signal if a prefab id has been acquired. More... | |
NetworkObject | Load (NetworkPrefabId prefabId, bool isSynchronous) |
Load a prefab by id. More... | |
int | RemoveInstance (NetworkPrefabId prefabId) |
Remove an instance of a prefab id. More... | |
bool | TryAddSource (INetworkPrefabSource source, out NetworkPrefabId id) |
Tries to add a prefab source to the table. More... | |
bool | Unload (NetworkPrefabId prefabId) |
Unload a prefab by id. More... | |
void | UnloadAll () |
Unload all prefabs. More... | |
int | UnloadUnreferenced (bool includeIncompleteLoads=false) |
Unload all unreferenced prefabs. More... | |
Public Attributes | |
NetworkPrefabTableOptions | Options = NetworkPrefabTableOptions.Default |
Options for the NetworkPrefabTable. More... | |
Properties | |
IReadOnlyList< INetworkPrefabSource > | Prefabs [get] |
All prefab sources. More... | |
int | Version [get] |
Prefab table version. Incremented every time a change occurs. More... | |
Class representing a table of network prefabs.
int AddInstance | ( | NetworkPrefabId | prefabId | ) |
Add an instance of a prefab id.
prefabId | Id of the prefab. |
NetworkPrefabId AddSource | ( | INetworkPrefabSource | source | ) |
Adds a prefab source to the table.
source | Prefab source to add. |
ArgumentException | Thrown if a prefab source with the same guid already exists. |
void Clear | ( | ) |
Clear the prefab table.
bool Contains | ( | NetworkPrefabId | prefabId | ) |
Returns true if the prefab table contains a prefab with the given id.
prefabId | Id of the prefab. |
IEnumerable<(NetworkPrefabId, INetworkPrefabSource)> GetEntries | ( | ) |
Returns all entries in the table.
NetworkObjectGuid GetGuid | ( | NetworkPrefabId | prefabId | ) |
Gets a prefab guid by id.
prefabId | Id of the prefab source. |
NetworkPrefabId GetId | ( | NetworkObjectGuid | guid | ) |
Gets a prefab id by guid.
guid | Guid of the prefab source. |
int GetInstancesCount | ( | NetworkPrefabId | prefabId | ) |
Get the instance count of a prefab id.
prefabId | Id of the prefab. |
INetworkPrefabSource GetSource | ( | NetworkObjectGuid | guid | ) |
Gets a prefab source by guid.
guid | Guid of the prefab source. |
INetworkPrefabSource GetSource | ( | NetworkPrefabId | prefabId | ) |
Gets a prefab source by id.
prefabId | Id of the prefab source. |
bool IsAcquired | ( | NetworkPrefabId | prefabId | ) |
Signal if a prefab id has been acquired.
prefabId | Id of the prefab. |
NetworkObject Load | ( | NetworkPrefabId | prefabId, |
bool | isSynchronous | ||
) |
Load a prefab by id.
prefabId | Id of the prefab. |
isSynchronous | If true, the load will be synchronous. |
int RemoveInstance | ( | NetworkPrefabId | prefabId | ) |
Remove an instance of a prefab id.
prefabId | Id of the prefab. |
bool TryAddSource | ( | INetworkPrefabSource | source, |
out NetworkPrefabId | id | ||
) |
Tries to add a prefab source to the table.
source | Prefab source to add. |
id | Id of the prefab source. |
ArgumentNullException | Thrown if source is null. |
bool Unload | ( | NetworkPrefabId | prefabId | ) |
Unload a prefab by id.
prefabId | Id of the prefab. |
void UnloadAll | ( | ) |
Unload all prefabs.
int UnloadUnreferenced | ( | bool | includeIncompleteLoads = false | ) |
Unload all unreferenced prefabs.
includeIncompleteLoads | If true, incomplete loads will be unloaded as well. |
Options for the NetworkPrefabTable.
|
get |
All prefab sources.
|
get |
Prefab table version. Incremented every time a change occurs.