ModifiableAdditionalStaticContent
A class in Root.Township, the global namespace.
Network entity that adds a ModifiableStaticObject on top of the baked static world and lets it be modified or restored. Saves its hash and whether it is created at runtime.
- Listed in Global namespace: M to O
- Inherits or implements
NetworkEntityBehaviour,ISavable<ModifiableAdditionalStaticContentSaveData>,ISavableSave<ModifiableAdditionalStaticContentSaveData>,ISavableSaveBase,IAdditionalStaticContent - Derived types
ModifiableAdditionalStaticContentSaveData
Constructors
| Member | What it is |
|---|---|
ModifiableAdditionalStaticContent() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
7 private and internal fields
| Member | What it is |
|---|---|
private ModifiableStaticObject basePrefab | Prefab of the modifiable static object to create. |
private ModifiableStaticObject instantiated | Meant to hold the created instance, but nothing assigns it in this build, so modify and restore do nothing for runtime-created content. |
private bool isSettingToUnmodifiedOnInitialize | If true, the server restores the content when the entity is first set up. |
private uint modifiableHash | Hash that ties this content to its modification state. Filled in when saved in the editor. |
private Transform mTransform | Backing field for Transform. |
private bool needsToInstantiate | True if the content is created at runtime rather than baked in. Set to false when saved in the editor. |
private MethodSync syncInstantiate | Method sync used to tell clients to create the content. |
Properties
| Member | What it is |
|---|---|
Transform Transform { get; } | Cached transform of this object. |
Methods
| Member | What it is |
|---|---|
override void Initialize() | Sets up the instantiate sync and creates the content, except on Android. |
override void InitializeAsServer(SpawnData spawnData) | Server: restores the content to unmodified if isSettingToUnmodifiedOnInitialize is set. |
void InstantiateContent(Transform parent, HideFlags hideFlags = 0) | Creates the base prefab under a parent and gives it this entity's modifiable hash. |
void Modify() | Marks the content as modified, through ModifiableStaticManager if it was baked in, or on the created instance otherwise. |
override void OnConnected(Player player) | On a simple server, tells a joining player to create the content if it is runtime-created. |
void Unmodify() | Restores the content to unmodified, through ModifiableStaticManager or on the created instance. |