NetIdentityComponent struct in Thread

Marks an entity as part of the shared world in a multiplayer game. It exists on every player's machine under the same uuid. One machine owns it and simulates it; the others show a copy that follows. See Multiplayer (co-op).

Properties

ReplicateTransformboolThe owner sends position and rotation ~20 times a second; copies interpolate ~100 ms behind. Default true.
ScriptsOnOwnerOnlyboolThis entity's scripts (and its children's) run only on the owner's machine. Default true. Turn off for a player whose stats the host keeps, or for scripts that only draw.
Owneruint8_tRuntime, not saved. The owner's player id: 0 (the host) for everything authored, the player's id for their own character.
SpawnedFromstd::stringRuntime, not saved. The prefab it was spawned from; empty for an entity authored in the scene.

On a copy

  • Rigid bodies are kinematic and follow the replicated transform.
  • A character controller is not simulated; its inner body stays on the character, so raycasts and triggers still see it.
  • Cameras are switched off, so the scene renders through your own character's camera.
  • Behaviour trees and navigation do not run.

When there is no session, none of this applies: everything is local.

NetIdentityComponent struct w Thread

Oznacza encję jako część wspólnego świata w grze wieloosobowej. Istnieje na komputerze każdego gracza pod tym samym UUID. Jeden komputer jest jej właścicielem i ją symuluje, a pozostałe pokazują kopię, która za nim podąża. Zobacz Multiplayer (co-op).

Właściwości

ReplicateTransformboolWłaściciel wysyła pozycję i obrót ok. 20 razy na sekundę, a kopie interpolują ok. 100 ms wstecz. Domyślnie true.
ScriptsOnOwnerOnlyboolSkrypty tej encji (i jej dzieci) działają tylko na komputerze właściciela. Domyślnie true. Wyłącz dla gracza, którego statystyki trzyma host, albo dla skryptów, które tylko coś rysują.
Owneruint8_tW czasie działania, nie zapisywane. Numer gracza-właściciela: 0 (host) dla wszystkiego, co jest w scenie, numer gracza dla jego własnej postaci.
SpawnedFromstd::stringW czasie działania, nie zapisywane. Prefab, z którego encję zespawnowano; puste dla encji wstawionej w scenie.

Na kopii

  • Ciała sztywne są kinematyczne i podążają za replikowanym transformem.
  • Kontroler postaci nie jest symulowany; jego wewnętrzne ciało zostaje na postaci, więc raycasty i triggery nadal ją widzą.
  • Kamery są wyłączone, więc scena renderuje się z kamery twojej postaci.
  • Drzewa zachowań i nawigacja nie działają.

Bez sesji nic z tego nie obowiązuje: wszystko jest lokalne.