Closed temel61 closed 2 months ago
Are you going to use addressable assets or not?
I am using addressable, but now I added my characters as prefab , I will try both because server cannot find my character to spawn in map.It works for LAN singleplayer.Any advice?
I think spawnobj is null
LiteNetLibIdentity spawnObj = Assets.GetObjectInstance( GameInstance.GetPlayerCharacterEntityHashAssetId(playerCharacterData.EntityId, out metaDataId), playerCharacterData.CurrentPosition, characterRotation);
// Set current character data
BasePlayerCharacterEntity playerCharacterEntity = spawnObj.GetComponent<BasePlayerCharacterEntity>();
Yes, it is relates to previous post which you choose to fix it by return true even when the data is incorrect and unable to load
I do not see any error during loading assets.It seems added BasePlayerChaarcterEntities successfully.I can see characters on home scene for character list.
INFO No Tag [2024-09-26 09:37:39] - BasePlayerCharacterEntity->PrepareRelatesData INFO No Tag [2024-09-26 09:37:43] - BasePlayerCharacterEntity->PrepareRelatesData INFO No Tag [2024-09-26 09:37:45] - BasePlayerCharacterEntity->PrepareRelatesData INFO No Tag [2024-09-26 09:37:50] - BasePlayerCharacterEntity->PrepareRelatesData INFO No Tag [2024-09-26 09:37:53] - BasePlayerCharacterEntity->PrepareRelatesData INFO No Tag [2024-09-26 09:37:54] - BasePlayerCharacterEntity->PrepareRelatesData INFO No Tag [2024-09-26 09:37:55] - BasePlayerCharacterEntity->PrepareRelatesData INFO No Tag [2024-09-26 09:37:56] - BasePlayerCharacterEntity->PrepareRelatesData
maybe sometings wrong here
public static int GetPlayerCharacterEntityHashAssetId(int entityId, out int? metaDataId)
{
metaDataId = null;
if (PlayerCharacterEntityMetaDataList.TryGetValue(entityId, out PlayerCharacterEntityMetaData metaData))
{
metaDataId = metaData.DataId;
return metaData.GetPlayerCharacterEntityHashAssetId();
}
else if (AddressablePlayerCharacterEntities.ContainsKey(entityId))
{
return entityId;
}
else if (PlayerCharacterEntities.ContainsKey(entityId))
{
return entityId;
}
return 0;
}
It worked for me but I have double same player in character selection list.
ERROR No Tag [2024-09-26 09:40:18] - NullReferenceException: Object reference not set to an instance of an object MultiplayerARPG.MMO.MapNetworkManager.SetPlayerReadyRoutine (System.Int64 connectionId, System.String userId, System.String accessToken, System.String selectCharacterId) (at D:/M3 Mobile/Assets/UnityMultiplayerARPG/MMO/Scripts/MMOGame/Networking/Map/MapNetworkManager.cs:585) Log_Map(Town)-Ch(1)-Alloc(False)-Instance().err.log