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