suriyun-production / mmorpg-kit-docs

This is document for MMORPG KIT project (https://www.assetstore.unity3d.com/#!/content/110188?aid=1100lGeN)
https://suriyun-production.github.io/mmorpg-kit-docs
49 stars 10 forks source link

MapNetworkManager.SetPlayerReadyRoutine Error in MMO v1.89 #2563

Closed temel61 closed 2 months ago

temel61 commented 2 months ago

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

insthync commented 2 months ago

Are you going to use addressable assets or not?

temel61 commented 2 months ago

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?

temel61 commented 2 months ago

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>();
insthync commented 2 months ago

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

temel61 commented 2 months ago

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

temel61 commented 2 months ago

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;
        }

if !EXCLUDE_PREFAB_REFS

        else if (PlayerCharacterEntities.ContainsKey(entityId))
        {
            return entityId;
        }

endif

        return 0;
    }
temel61 commented 2 months ago

It worked for me but I have double same player in character selection list.