浏览代码
BROKEN ( New NGO NetworkManager pattern causes initialization issues)
BROKEN ( New NGO NetworkManager pattern causes initialization issues)
Need to solve NetworkManager vs IngameRunnerPrefab race condition. Ingamerunnerprefab does not seem to get OnSpawned??/main/staging/2021_Upgrade
当前提交
2ea6c8bc
共有 14 个文件被更改,包括 399 次插入 和 142 次删除
-
7Assets/Prefabs/GameManager.prefab
-
189Assets/Prefabs/NGO/InGameLogic.prefab
-
62Assets/Scenes/mainScene.unity
-
1Assets/Scripts/GameLobby/Lobby/LobbyContentUpdater.cs
-
3Assets/Scripts/GameLobby/NGO/InGameRunner.cs
-
27Assets/Scripts/GameLobby/NGO/SetupInGame.cs
-
4Assets/Scripts/GameLobby/Relay/RelayAPIInterface.cs
-
4Packages/manifest.json
-
18Packages/packages-lock.json
-
2ProjectSettings/RiderScriptEditorPersistedState.asset
-
112Assets/Prefabs/NGO/NetworkManager.prefab
-
7Assets/Prefabs/NGO/NetworkManager.prefab.meta
-
94Assets/Scripts/GameLobby/Tests/PlayMode/AsyncLobbyTest.cs
-
11Assets/Scripts/GameLobby/Tests/PlayMode/AsyncLobbyTest.cs.meta
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!1 &5481270937743757918 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 5665493986528408842} |
|||
- component: {fileID: 5021303663353436182} |
|||
- component: {fileID: 1765689956051871792} |
|||
m_Layer: 0 |
|||
m_Name: NetworkManager |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!4 &5665493986528408842 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 5481270937743757918} |
|||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 52.01943, z: -6} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_ConstrainProportionsScale: 0 |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!114 &5021303663353436182 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 5481270937743757918} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 593a2fe42fa9d37498c96f9a383b6521, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
RunInBackground: 0 |
|||
LogLevel: 1 |
|||
NetworkConfig: |
|||
ProtocolVersion: 0 |
|||
NetworkTransport: {fileID: 1765689956051871792} |
|||
PlayerPrefab: {fileID: 0} |
|||
NetworkPrefabs: |
|||
- Override: 0 |
|||
Prefab: {fileID: 3227847727972158006, guid: 905594b4ee5bb864a84af916cc445d1b, type: 3} |
|||
SourcePrefabToOverride: {fileID: 0} |
|||
SourceHashToOverride: 0 |
|||
OverridingTargetPrefab: {fileID: 0} |
|||
- Override: 0 |
|||
Prefab: {fileID: 5240148789413552765, guid: f42ed38d10b57ec48870f76a7a63389e, type: 3} |
|||
SourcePrefabToOverride: {fileID: 0} |
|||
SourceHashToOverride: 0 |
|||
OverridingTargetPrefab: {fileID: 0} |
|||
- Override: 0 |
|||
Prefab: {fileID: 8828823320646980938, guid: e371ca3112f9e244ab574b472387b64b, type: 3} |
|||
SourcePrefabToOverride: {fileID: 0} |
|||
SourceHashToOverride: 0 |
|||
OverridingTargetPrefab: {fileID: 0} |
|||
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: 1 |
|||
EnableNetworkLogs: 1 |
|||
--- !u!114 &1765689956051871792 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 5481270937743757918} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 6960e84d07fb87f47956e7a81d71c4e6, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_ProtocolType: 1 |
|||
m_MaxPacketQueueSize: 512 |
|||
m_MaxPayloadSize: 6144 |
|||
m_MaxSendQueueSize: 98304 |
|||
m_HeartbeatTimeoutMS: 500 |
|||
m_ConnectTimeoutMS: 1000 |
|||
m_MaxConnectAttempts: 60 |
|||
m_DisconnectTimeoutMS: 30000 |
|||
ConnectionData: |
|||
Address: 127.0.0.1 |
|||
Port: 7777 |
|||
ServerListenAddress: |
|||
DebugSimulator: |
|||
PacketDelayMS: 0 |
|||
PacketJitterMS: 0 |
|||
PacketDropRate: 0 |
|
|||
fileFormatVersion: 2 |
|||
guid: b963f71e4874d4066bc72b9224e3ffce |
|||
PrefabImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Unity.Services.Lobbies; |
|||
using Unity.Services.Lobbies.Models; |
|||
using Unity.Services.Relay; |
|||
using Unity.Services.Relay.Models; |
|||
using UnityEngine; |
|||
|
|||
namespace LobbyAsync |
|||
{ |
|||
public class LobbyRelayTest |
|||
{ |
|||
|
|||
|
|||
public async Task Join(string lobbyId, string password = "") |
|||
{ |
|||
try |
|||
{/* |
|||
// Authenticate
|
|||
await AuthenticationService.Instance.SignInAnonymouslyAsync(); |
|||
|
|||
// Join Lobby
|
|||
LobbyPlayer player = new LobbyPlayer(AuthenticationService.Instance.PlayerId); |
|||
JoinLobbyByIdOptions options = new JoinLobbyByIdOptions() |
|||
{ |
|||
Player = player |
|||
}; |
|||
Lobby lobby = = await LobbyHelper.Instance.JoinLobbyByIdAsync(lobbyId, options); |
|||
|
|||
// Join Relay
|
|||
string joinCode = lobby.Data["joinCode"].Value; |
|||
JoinAllocation join = await Relay.Instance.JoinAllocationAsync(joinCode); |
|||
await Lobbies.Instance.UpdatePlayerAsync(lobby.Id, player.Id, new UpdatePlayerOptions() |
|||
{ |
|||
AllocationId = join.AllocationId.ToString(), |
|||
ConnectionInfo = joinCode |
|||
}); |
|||
relayTransport.SetClientRelayData(join.RelayServer.IpV4, (ushort) join.RelayServer.Port, |
|||
join.AllocationIdBytes, join.Key, join.ConnectionData, join.HostConnectionData, true); |
|||
|
|||
// Start Client
|
|||
NetworkManager.Singleton.StartClient();*/ |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
Debug.LogError(e); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
public async Task Create() |
|||
{ |
|||
|
|||
try |
|||
{ |
|||
/* |
|||
// Authenticate
|
|||
await Authenticate(); |
|||
|
|||
|
|||
// Allocate Relay
|
|||
Allocation allocation = await Relay.Instance.CreateAllocationAsync(maxPlayers); |
|||
relayTransport.SetHostRelayData(allocation.RelayServer.IpV4, (ushort)allocation.RelayServer.Port, allocation.AllocationIdBytes, allocation.Key, allocation.ConnectionData, true); |
|||
|
|||
// Generate Join Code
|
|||
string joinCode = await Relay.Instance.GetJoinCodeAsync(allocation.AllocationId); |
|||
|
|||
// Create Lobby
|
|||
CreateLobbyOptions options = new CreateLobbyOptions() |
|||
{ |
|||
IsPrivate = isPrivate, |
|||
Data = new Dictionary<string, DataObject>() |
|||
{ |
|||
{ "joinCode", new DataObject(DataObject.VisibilityOptions.Public, joinCode) }, |
|||
}, |
|||
Player = new LobbyPlayer(AuthenticationService.Instance.PlayerId, joinCode, null, allocation.AllocationId.ToString()) |
|||
}; |
|||
Lobby lobby = await LobbyHelper.Instance.CreateLobbyAsync(worldNameInputField.text, maxPlayers, options); |
|||
|
|||
// Start Host
|
|||
NetworkManager.Singleton.StartHost();*/ |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
Debug.LogError(e); |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: adc002dd7627a40afac107b97fcc05a0 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue