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.
Checking the stable version of the documentation...
SceneReplicationConfig
繼承: Resource < RefCounted < Object
配置,能夠讓 MultiplayerSynchronizer 對屬性進行同步。
方法
void |
add_property(path: NodePath, index: int = -1) |
get_properties() const |
|
has_property(path: NodePath) const |
|
property_get_index(path: NodePath) const |
|
property_get_spawn(path: NodePath) |
|
property_get_sync(path: NodePath) |
|
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 🔗
如果已將給定的 path 設定為同步,則回傳 true。
int property_get_index(path: NodePath) const 🔗
搜尋給定 path 的索引。
ReplicationMode property_get_replication_mode(path: NodePath) 🔗
回傳給定 path 標識的屬性的複製模式。
bool property_get_spawn(path: NodePath) 🔗
回傳已將 path 對應的屬性設定為在出生時同步,則回傳 true。
bool property_get_sync(path: NodePath) 🔗
已棄用: Use property_get_replication_mode() instead.
如果給定 path 標識的屬性被設定為在處理時同步,則回傳 true。
bool property_get_watch(path: NodePath) 🔗
已棄用: Use property_get_replication_mode() instead.
如果給定 path 標識的屬性被設定為在處理期間檢測到更改時可靠地同步,則回傳 true。
void property_set_replication_mode(path: NodePath, mode: ReplicationMode) 🔗
為路徑為 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.
設定給定 path 標識的屬性是否被設定為在處理時同步。
void property_set_watch(path: NodePath, enabled: bool) 🔗
已棄用: Use property_set_replication_mode() with REPLICATION_MODE_ON_CHANGE instead.
設定給定 path 標識的屬性是否被設定為在處理期間檢測到更改時可靠地同步。
void remove_property(path: NodePath) 🔗
從配置中移除屬性,該屬性由 path 指定。