Client NetworkObjects experience Awake, Start, OnEnable, and TriggerEnter, CollisionEnter at world 0,0,0 upon instantiation
I maintainer di solito rispondono entro 3 giorni
@NoelStephensUnity ci sta già lavorando.
Dal 17/7/2025.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Description
When a client spawns a NetworkObject via NetworkSpawnManage.InstantiateNetworkPrefab() there is no position or rotation data passed into UnityEngine.Object.Instantiate() and therefore the object is created at world 0,0,0. On a later line of code the position and rotation are assigned, after instantiation.
This means Awake, Start, and OnEnable are all called when at world 0,0,0 -- this is arguably expected and why you have OnNetworkSpawn.
However, OnTriggerEnter (and probably OnCollisionEnter) also fire for things at world 0,0,0. That problem is outside of the scope of the OnNetworkSpawn warmup in my opinion.
Developers should not have to write custom code to handle this problem when the position and rotation could simply be passed into the instantiation.
internal NetworkObject InstantiateNetworkPrefab(GameObject networkPrefab, uint prefabGlobalObjectIdHash, Vector3? position, Quaternion? rotation)
{
Vector3 defaultPosition = position ?? Vector3.zero;
Quaternion defaultRotation = rotation ?? Quaternion.identity;
var networkObject = UnityEngine.Object.Instantiate(networkPrefab, defaultPosition, defaultRotation).GetComponent<NetworkObject>();
// networkObject.transform.position = position ?? networkObject.transform.position;
// networkObject.transform.rotation = rotation ?? networkObject.transform.rotation;
networkObject.NetworkManagerOwner = NetworkManager;
networkObject.PrefabGlobalObjectIdHash = prefabGlobalObjectIdHash;
return networkObject;
}
Environment
- OS: Windows 11
- Unity Version: 6000.1.3f1
- Netcode Version: 2.4.2
- Netcode Topology: Client-Server
- Lingua principale
- C#
- Stelle
- 2.3k
- Fork
- 465
- Merge medio
- 3g 12h
- PR unite (30g)
- 39
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Unity-Technologies/com.unity.netcode.gameobjects
-
TimeSyncMessage is sent reliably, so a late one resets the client clock backwards and stalls its NetworkTransformsForse già presa @reginaldalfret l’ha presa 8 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
Unity-Technologies/com.unity.netcode.gameobjects#4249 ·
I maintainer di solito rispondono entro 3 giorni
-
NetworkTransform: half-float base update dropped as out of order when UseUnreliableDeltas is on, so later deltas decode ~2 m offForse già presa @NoelStephensUnity l’ha presa 8 giorni fa. Apertaport:3.x-completed priority:medium stat:imported type:bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 57/100
Unity-Technologies/com.unity.netcode.gameobjects#4248 ·
I maintainer di solito rispondono entro 3 giorni
-
Tracking type:feature-2.x
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
Unity-Technologies/com.unity.netcode.gameobjects#3870 · 5 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
Tracking type:feature
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
Unity-Technologies/com.unity.netcode.gameobjects#3830 · 7 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
priority:medium stat:imported type:feature type:feature-2.x
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
Unity-Technologies/com.unity.netcode.gameobjects#3706 · 5 commenti ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di Unity-Technologies/com.unity.netcode.gameobjects
Issue simili
-
hand-to-AI
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
CactuseSecurity/firewall-orchestrator#5803 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
DXF with empty names failsApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 3 giorni
-
bug python
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
ilia-sokolov/OfficeAgent.NET#89 ·
I maintainer di solito rispondono entro 13 giorni