Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

SceneReplicationConfig

繼承: Resource < RefCounted < Object

配置,能夠讓 MultiplayerSynchronizer 對屬性進行同步。

方法

void

add_property(path: NodePath, index: int = -1)

Array[NodePath]

get_properties() const

bool

has_property(path: NodePath) const

int

property_get_index(path: NodePath) const

ReplicationMode

property_get_replication_mode(path: NodePath)

bool

property_get_spawn(path: NodePath)

bool

property_get_sync(path: NodePath)

bool

property_get_watch(path: NodePath)

void

property_set_replication_mode(path: NodePath, mode: ReplicationMode)

void

property_set_spawn(path: NodePath, enabled: bool)

void

property_set_sync(path: NodePath, enabled: bool)

void

property_set_watch(path: NodePath, enabled: bool)

void

remove_property(path: NodePath)


列舉

enum ReplicationMode: 🔗

ReplicationMode REPLICATION_MODE_NEVER = 0

不保持給定屬性同步。

ReplicationMode REPLICATION_MODE_ALWAYS = 1

透過使用不可靠的傳輸模式不斷發送更新來複製程序上的給定屬性。

ReplicationMode REPLICATION_MODE_ON_CHANGE = 2

當其值變更時,透過使用可靠傳輸模式發送更新來複製程序上的給定屬性。


方法說明

void add_property(path: NodePath, index: int = -1) 🔗

將屬性新增至同步屬性列表,該屬性由 path 指定,還可以傳入索引 index

注意:屬性同步的限制詳見 MultiplayerSynchronizer


Array[NodePath] get_properties() const 🔗

返回同步屬性的 NodePath 列表。


bool has_property(path: NodePath) const 🔗

Returns true if the given path is configured for synchronization.


int property_get_index(path: NodePath) const 🔗

搜尋給定 path 的索引。


ReplicationMode property_get_replication_mode(path: NodePath) 🔗

Returns the replication mode for the property identified by the given path.


bool property_get_spawn(path: NodePath) 🔗

Returns true if the property identified by the given path is configured to be synchronized on spawn.


bool property_get_sync(path: NodePath) 🔗

已棄用: Use property_get_replication_mode() instead.

Returns true if the property identified by the given path is configured to be synchronized on process.


bool property_get_watch(path: NodePath) 🔗

已棄用: Use property_get_replication_mode() instead.

Returns true if the property identified by the given path is configured to be reliably synchronized when changes are detected on process.


void property_set_replication_mode(path: NodePath, mode: ReplicationMode) 🔗

Sets the synchronization mode for the property identified by the given path.


void property_set_spawn(path: NodePath, enabled: bool) 🔗

設定屬性是否配置為在出生時同步,該屬性由 path 指定。


void property_set_sync(path: NodePath, enabled: bool) 🔗

已棄用: Use property_set_replication_mode() with REPLICATION_MODE_ALWAYS instead.

Sets whether the property identified by the given path is configured to be synchronized on process.


void property_set_watch(path: NodePath, enabled: bool) 🔗

已棄用: Use property_set_replication_mode() with REPLICATION_MODE_ON_CHANGE instead.

Sets whether the property identified by the given path is configured to be reliably synchronized when changes are detected on process.


void remove_property(path: NodePath) 🔗

從配置中移除屬性,該屬性由 path 指定。