Skip to main content

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.

Constructors​

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

Fields​

7 private and internal fields
MemberWhat it is
private ModifiableStaticObject basePrefabPrefab of the modifiable static object to create.
private ModifiableStaticObject instantiatedMeant to hold the created instance, but nothing assigns it in this build, so modify and restore do nothing for runtime-created content.
private bool isSettingToUnmodifiedOnInitializeIf true, the server restores the content when the entity is first set up.
private uint modifiableHashHash that ties this content to its modification state. Filled in when saved in the editor.
private Transform mTransformBacking field for Transform.
private bool needsToInstantiateTrue if the content is created at runtime rather than baked in. Set to false when saved in the editor.
private MethodSync syncInstantiateMethod sync used to tell clients to create the content.

Properties​

MemberWhat it is
Transform Transform { get; }Cached transform of this object.

Methods​

MemberWhat 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.
1 private and internal method
MemberWhat it is
private void SyncInstantiate(IPlayer player, Stream stream)Message handler: remote clients create the content when they receive it.