Model

self:set_syncer

Server

Assigns the peer that holds sync authority over the model

Syntax

local status = self:set_syncer(
    peer_id
)

Parameters

TypeNameDescription
intpeer_idPeer that receives sync authority:
• When 0 - authority is handed back to the server
• Any other value - must be the id of a connected peer, otherwise an error is raised

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

Hand a model to a connected peer
core.model.load("character", "models/character.glb")

local entity = core.model.create("character")
local peers = core.engine.get_peers()

if peers[1] then
    entity:set_syncer(peers[1])
end

On this page