I can get the Monster to spawn Object based on CastTime, but I am looking for a solution to get it spawn based on its AnimationTrigger Event.
This works when host and server is editor. But does not work in the build game. The « CanMonsterFire » variable always remains false.Any suggestions on how to get it done ?Thanks in advance.

void Update()
{
if (!isServer)
return;
Debug.Log("CanMonsterFire == " + CanMonsterFire);
//Variable CanMonsterFire is always false when running Serveronly
//When running from Editor Host as Server and Play, it works
if (CanMonsterFire == false)
{
animator.SetBool("CASTING", true);
animator.SetBool("TESTING", true);
}
else
{
SpawnFire();
}
}
public void SpawnFire()
{
CmdSpawnFire();
}
[Command]
public void CmdSpawnFire()
{
Debug.Log("CmdSpawnFire");
GameObject instance = (GameObject)Instantiate(shot, shotSpawn.position, shotSpawn.rotation);
NetworkServer.Spawn(instance);
}
public void MonsterAttackStart()
{
Debug.Log("EventCalled start");
CanMonsterFire = true;
}