Add NGO networking with owner-authoritative player position sync
Install Netcode for GameObjects 2.13.0 + Unity Transport 2.6.0 and wire up the first networking milestone: syncing player position/rotation across clients. - NetworkBootstrap: Host/Client/Server controls (OnGUI + H/C hotkeys) for local clone testing over loopback 127.0.0.1:7777. - NetworkPlayerSetup: per-avatar owner gating. The local owner binds the GameModeManager and cameras to itself; remote avatars disable their controller/CharacterController and receive transform via NetworkTransform. - GameModeManager.BindLocalPlayer: central runtime rebind to the locally spawned player. - FirstPersonController.SetPlayer: explicit runtime rebind hook. - Player prefab: NetworkObject + NetworkTransform (owner-authoritative, position + rotation) + NetworkPlayerSetup; registered as PlayerPrefab. - Scene: NetworkManager + UnityTransport added; the fixed scene player instance removed in favor of spawn-on-connect. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
c0ec65058b
commit
4fa443f630
13 files changed
+435
-91
No files matched your search
+127
-89
@@ -735,7 +735,7 @@ MonoBehaviour:
|
||||
m_StreamingVersion: 20241001
|
||||
m_LegacyPriority: 0
|
||||
Target:
|
||||
TrackingTarget: {fileID: 5297240775790447668}
|
||||
TrackingTarget: {fileID: 0}
|
||||
LookAtTarget: {fileID: 0}
|
||||
CustomLookAtTarget: 0
|
||||
Lens:
|
||||
@@ -1218,6 +1218,127 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 347639557}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &284910513
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 284910517}
|
||||
- component: {fileID: 284910516}
|
||||
- component: {fileID: 284910515}
|
||||
- component: {fileID: 284910514}
|
||||
m_Layer: 0
|
||||
m_Name: NetworkManager
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &284910514
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 284910513}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 519095f0598dfdf4ebe457561f77771c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::NetworkBootstrap
|
||||
showGui: 1
|
||||
enableHotkeys: 1
|
||||
--- !u!114 &284910515
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 284910513}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6960e84d07fb87f47956e7a81d71c4e6, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Unity.Netcode.Runtime::Unity.Netcode.Transports.UTP.UnityTransport
|
||||
m_ProtocolType: 0
|
||||
m_UseWebSockets: 0
|
||||
m_UseEncryption: 0
|
||||
m_MaxPacketQueueSize: 128
|
||||
m_MaxPayloadSize: 6144
|
||||
m_HeartbeatTimeoutMS: 500
|
||||
m_ConnectTimeoutMS: 1000
|
||||
m_MaxConnectAttempts: 60
|
||||
m_DisconnectTimeoutMS: 30000
|
||||
ConnectionData:
|
||||
Address: 127.0.0.1
|
||||
Port: 7777
|
||||
WebSocketPath:
|
||||
ServerListenAddress: 0.0.0.0
|
||||
ClientBindPort: 0
|
||||
DebugSimulator:
|
||||
PacketDelayMS: 0
|
||||
PacketJitterMS: 0
|
||||
PacketDropRate: 0
|
||||
--- !u!114 &284910516
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 284910513}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 593a2fe42fa9d37498c96f9a383b6521, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Unity.Netcode.Runtime::Unity.Netcode.NetworkManager
|
||||
NetworkManagerExpanded: 0
|
||||
NetworkConfig:
|
||||
ProtocolVersion: 0
|
||||
NetworkTransport: {fileID: 284910515}
|
||||
PlayerPrefab: {fileID: 5384024074013944205, guid: 97017ed3bb40aff4e885440d9a7336ee, type: 3}
|
||||
Prefabs:
|
||||
NetworkPrefabsLists:
|
||||
- {fileID: 11400000, guid: 231a4db0603e8994f9e13e19108d58d1, type: 2}
|
||||
TickRate: 30
|
||||
ClientConnectionBufferTimeout: 10
|
||||
ConnectionApproval: 0
|
||||
ConnectionData:
|
||||
EnableTimeResync: 0
|
||||
TimeResyncInterval: 30
|
||||
EnsureNetworkVariableLengthSafety: 0
|
||||
EnableSceneManagement: 1
|
||||
ForceSamePrefabs: 1
|
||||
RecycleNetworkIds: 1
|
||||
NetworkIdRecycleDelay: 120
|
||||
RpcHashSize: 0
|
||||
LoadSceneTimeOut: 120
|
||||
SpawnTimeout: 10
|
||||
EnableNetworkLogs: 1
|
||||
NetworkTopology: 0
|
||||
UseCMBService: 0
|
||||
AutoSpawnPlayerPrefabClientSide: 1
|
||||
NetworkProfilingMetrics: 1
|
||||
OldPrefabList: []
|
||||
RunInBackground: 1
|
||||
LogLevel: 1
|
||||
--- !u!4 &284910517
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 284910513}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &286369291
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -2541,9 +2662,9 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 43b8f1dc43642294f99fab0aaabf6197, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::FirstPersonController
|
||||
cameraTarget: {fileID: 897939465}
|
||||
cameraTarget: {fileID: 0}
|
||||
hiddenRenderers:
|
||||
- {fileID: 1294962561}
|
||||
- {fileID: 0}
|
||||
horizontalSensitivity: 0.1
|
||||
verticalSensitivity: 0.075
|
||||
invertY: 0
|
||||
@@ -3737,7 +3858,7 @@ Transform:
|
||||
m_GameObject: {fileID: 829281440}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -2, y: 0.5, z: 1}
|
||||
m_LocalPosition: {x: -2, y: 0.5, z: 1.5}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@@ -4063,11 +4184,6 @@ MeshCollider:
|
||||
m_Convex: 0
|
||||
m_CookingOptions: 30
|
||||
m_Mesh: {fileID: 4300000, guid: 6d5becbf770f24fa3ab1ceaba45fcefa, type: 3}
|
||||
--- !u!4 &897939465 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 5751241787949053935, guid: cf153a3aea3d5da4f9d4cdbff0be8180, type: 3}
|
||||
m_PrefabInstance: {fileID: 5297240775790447667}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &924705986
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -4633,17 +4749,6 @@ Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 411130, guid: a4bb788560e5d4617b970cd301097f38, type: 3}
|
||||
m_PrefabInstance: {fileID: 1039758568}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &1141039642 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 8381518232634759850, guid: cf153a3aea3d5da4f9d4cdbff0be8180, type: 3}
|
||||
m_PrefabInstance: {fileID: 5297240775790447667}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 463b6be548abf464287096e1e92fcd01, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::PlayerCharacterController
|
||||
--- !u!1001 &1148993634
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -5113,11 +5218,6 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!137 &1294962561 stripped
|
||||
SkinnedMeshRenderer:
|
||||
m_CorrespondingSourceObject: {fileID: 8001664246499114791, guid: cf153a3aea3d5da4f9d4cdbff0be8180, type: 3}
|
||||
m_PrefabInstance: {fileID: 5297240775790447667}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &1317768121
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -5904,7 +6004,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 730466b26610d95498d22ab748d855a7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::GameModeManager
|
||||
player: {fileID: 1141039642}
|
||||
player: {fileID: 0}
|
||||
cameraInput: {fileID: 172071431}
|
||||
painter: {fileID: 0}
|
||||
freeCam: {fileID: 1282734304}
|
||||
@@ -7782,68 +7882,6 @@ Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4922444305696846, guid: ac1cc01cb5dbf5d4f869c403b38f8a21, type: 3}
|
||||
m_PrefabInstance: {fileID: 1424346480}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &5297240775790447667
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 1950906664192868687, guid: cf153a3aea3d5da4f9d4cdbff0be8180, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1950906664192868687, guid: cf153a3aea3d5da4f9d4cdbff0be8180, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1950906664192868687, guid: cf153a3aea3d5da4f9d4cdbff0be8180, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1950906664192868687, guid: cf153a3aea3d5da4f9d4cdbff0be8180, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1950906664192868687, guid: cf153a3aea3d5da4f9d4cdbff0be8180, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1950906664192868687, guid: cf153a3aea3d5da4f9d4cdbff0be8180, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1950906664192868687, guid: cf153a3aea3d5da4f9d4cdbff0be8180, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1950906664192868687, guid: cf153a3aea3d5da4f9d4cdbff0be8180, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1950906664192868687, guid: cf153a3aea3d5da4f9d4cdbff0be8180, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1950906664192868687, guid: cf153a3aea3d5da4f9d4cdbff0be8180, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3510981371713521867, guid: cf153a3aea3d5da4f9d4cdbff0be8180, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Player
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: cf153a3aea3d5da4f9d4cdbff0be8180, type: 3}
|
||||
--- !u!4 &5297240775790447668 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 5067936922952835876, guid: cf153a3aea3d5da4f9d4cdbff0be8180, type: 3}
|
||||
m_PrefabInstance: {fileID: 5297240775790447667}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1660057539 &9223372036854775807
|
||||
SceneRoots:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -7857,7 +7895,7 @@ SceneRoots:
|
||||
- {fileID: 832575519}
|
||||
- {fileID: 410087041}
|
||||
- {fileID: 2025317892}
|
||||
- {fileID: 5297240775790447667}
|
||||
- {fileID: 686187287}
|
||||
- {fileID: 489277934}
|
||||
- {fileID: 347639557}
|
||||
- {fileID: 284910517}
|
||||
Reference in new issue
Block a user