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
标识的属性的复制模式。请参阅 ReplicationMode。
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
的属性设置同步模式。见 ReplicationMode。
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
指定。