Skip to main content

NetworkEntityParent

A class in Root.Township, Alta.Networking.

Base of NetworkPrefab and NetworkScene. Holds the list of child network entities embedded in it, and gives each an EmbeddedId equal to its index.

Constructors​

MemberWhat it is
NetworkEntityParent()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

MemberWhat it is
protected List<NetworkEntity> embeddedEntitiesThe child network entities embedded in this one, indexed by their embedded id. Backs Embedded.
protected static Logger loggerNLog logger for this class.
1 private and internal field
MemberWhat it is
private int nextSceneEntityIdCounter behind NextEmbeddedEntityId.

Properties​

MemberWhat it is
List<NetworkEntity> Embedded { get; }Child entities embedded in this prefab or scene. An entity's EmbeddedId is its index here.
bool IsEmbeddedUpdated { get; set; }Set once embedded ids are assigned, so play mode doesn't redo it.
1 private and internal property
MemberWhat it is
private int NextEmbeddedEntityId { get; }Returns the next embedded id and increments it. Not called anywhere.

Methods​

MemberWhat it is
virtual void OnValidate()Editor only: refreshes embedded ids and walks child entities whose nearest parent is this one.
void RegisterEmbeddedEntity(NetworkEntity entity)Empty in this build, so OnValidate doesn't actually add anything.
protected void FindDuplicateHashes()Empty in this build.
protected virtual void UpdateEntityEmbeddedIds()Removes null or self entries from the list and sets each entity's EmbeddedId to its index.