Hi,
Although the error is annoying it doesn't interfere with the game,
the error is caused by how the bots are destroyed, I have fixed this error but I have refactored a lot of code.
You can try this, I have resume the fix to these changes but I'm not sure if this will work as intended with just this:
in bl_AIManager.cs -> SpawnPendingBot() -> change this line:
Destroy(SpawningBots[0].gameObject);
with:
Code: Select all
PhotonNetwork.Destroy(SpawningBots[0].gameObject);
in bl_AIShooterAgent.cs -> replace the function DestroyBot(...) -> with this:
Code: Select all
public void DestroyBot(NetHashTable data, PhotonMessageInfo info)
{
if (data.ContainsKey("instant"))
{
if(PhotonNetwork.IsMasterClient) PhotonNetwork.Destroy(gameObject);
return;
}
Vector3 position = (Vector3)data["direction"];
AIAnim.Ragdolled(position, data.ContainsKey("explosion"));
if ((PhotonNetwork.Time - info.SentServerTime) > bl_GameData.Instance.PlayerRespawnTime + 1)
{
Debug.LogWarning("The death call get with too much delay.");
}
this.InvokeAfter(bl_GameData.Instance.PlayerRespawnTime + 2, () =>
{
if(GetGameMode.GetGameModeInfo().onRoundStartedSpawn != GameModeSettings.OnRoundStartedSpawn.WaitUntilRoundFinish)
Debug.LogWarning("For some reason, this bot has not been destroyed yet.");
});
}
in bl_AIShooterHealth.cs -> Die(...) -> at the very bottom of the function -> replace these lines:
Code: Select all
if (PhotonNetwork.IsMasterClient)
{
if (!isOneTeamMode)
{
if (m_AIShooter.AITeam == PhotonNetwork.LocalPlayer.GetPlayerTeam())
{
GameObject di = bl_ObjectPooling.Instance.Instantiate("deathicon", transform.position, transform.rotation);
di.GetComponent<bl_ClampIcon>().SetTempIcon(DeathIcon, 5, 20);
}
}
AIManager.OnBotDeath(m_AIShooter, killerBot);
}
var deathData = bl_UtilityHelper.CreatePhotonHashTable();
deathData.Add("type", AIRemoteCallType.DestroyBot);
deathData.Add("direction", direction);
if (weaponName.Contains("Grenade"))
{
deathData.Add("explosion", true);
}
this.photonView.RPC(bl_AIShooterAgent.RPC_NAME, RpcTarget.AllBuffered, deathData);//callback is in bl_AIShooterAgent.cs
with these:
Code: Select all
if (bl_PhotonNetwork.IsMasterClient)
{
//respawn management here
//only master client called it since the spawn will be sync by PhotonNetwork.Instantiate()
AIManager.OnBotDeath(m_AIShooter, killerBot);
//Only Master client should send the RPC
var deathData = bl_UtilityHelper.CreatePhotonHashTable();
deathData.Add("type", AIRemoteCallType.DestroyBot);
deathData.Add("direction", direction);
if (weaponName.Contains("Grenade"))
{
deathData.Add("explosion", true);
}
//Should buffer this RPC?
this.photonView.RPC(bl_AIShooterAgent.RPC_NAME, RpcTarget.All, deathData);//callback is in bl_AIShooterAgent.cs -> DestroyBot(...)
}
That should do it.