Closed temel61 closed 1 month ago
What? it must ride easter cow, instead of bestial soldier?
it must be summon nirvana dragon (Blue dragon).But it summon wrong vehicle.I added some debug.log in code.Why it always changing?.
You may try check if asset ID is difference or not in your vehicle entity -> LiteNetLibIdentity
component
It always calls last vehicle in the list.
Please do what I've told you.
I will do that.But my only horses inluded in to addressableplayer prefab list.No camel, no alpaca,no tiger in the list.
I don't understand what the log is telling
I use alpaca mount with HashAsassetId 372029326, but It found griffin with HashAsassetId 372029326, same key but different prefab in GuidToPrefabs.I think it create same HashAssetId for different entity or duplicate entity.
BaseGameEntity_MountFunction.cs
public virtual async void Mount(VehicleEntity prefab, AssetReferenceLiteNetLibBehaviour<VehicleEntity> addressablePrefab)
{
if (!IsServer || (prefab == null && !addressablePrefab.IsDataValid()) || Time.unscaledTime - _lastMountTime < CurrentGameInstance.mountDelay)
return;
if (addressablePrefab != null)
{
Debug.Log("Start_Name : " + addressablePrefab.editorAsset);
Debug.Log("Start_HashAssetId : " + addressablePrefab.HashAssetId);
Debug.Log("Start_AssetGUID : " + addressablePrefab.AssetGUID);
}
_lastMountTime = Time.unscaledTime;
Vector3 enterPosition = EntityTransform.position;
if (PassengingVehicleEntity != null)
{
enterPosition = PassengingVehicleEntity.Entity.EntityTransform.position;
await ExitVehicle();
}
// Instantiate new mount entity
LiteNetLibIdentity spawnObj;
if (prefab != null)
{
spawnObj = BaseGameNetworkManager.Singleton.Assets.GetObjectInstance(
prefab.Identity.HashAssetId, enterPosition,
Quaternion.Euler(0, EntityTransform.eulerAngles.y, 0));
}
else if (addressablePrefab.IsDataValid())
{
spawnObj = BaseGameNetworkManager.Singleton.Assets.GetObjectInstance(
addressablePrefab.HashAssetId, enterPosition,
Quaternion.Euler(0, EntityTransform.eulerAngles.y, 0));
}
else
{
return;
}
if (spawnObj == null)
{
return;
}
VehicleEntity vehicle = spawnObj.GetComponent<VehicleEntity>();
if (addressablePrefab != null)
{
Debug.Log("Result_AssetId : " + vehicle.Title);
Debug.Log("Result_AssetId : " + spawnObj.AssetId);
Debug.Log("Result_HashAssetId : " + spawnObj.HashAssetId);
}
BaseGameNetworkManager.Singleton.Assets.NetworkSpawn(spawnObj, 0, ConnectionId);
// Seat index for mount entity always 0
await EnterVehicle(vehicle, 0);
}
MountItem.cs
public void UseItem(BaseCharacterEntity characterEntity, int itemIndex, CharacterItem characterItem, int amount)
{
if (!characterEntity.CanUseItem() || characterItem.level <= 0)
return;
if(AddressableVehicleEntity != null)
{
Debug.Log("UseItem_editorAsset : " + AddressableVehicleEntity.editorAsset);
Debug.Log("UseItem_HashAssetId : " + AddressableVehicleEntity.HashAssetId);
}
characterEntity.Mount(VehicleEntity, AddressableVehicleEntity);
}
Okay, then you have to fix duplicated key by change a asset ID in LiteNetLibIdentity
component
It calls wrong different mount when I click use button.