Blinking object in the network

The picture shows that the object on server is moving normally, but on the client can constantly blinking and can be gone for a while.

Spawn AI object code

void Update () 
{
	

		if(SpawnReloadTime > 0) SpawnReloadTime -= Time.deltaTime;
		if(SpawnReloadTime <= 0)
		{
		
			if(Network.isServer)
			{
				GameObject EnemyCreepAI  = Network.Instantiate(EnemyPrefab,transform.position,Quaternion.identity,0) as GameObject;			
			}
			
			SpawnReloadTime = SpawnReloadCoolDown;
		}
	
}

AI Script

void Update () 
{

			
	      if(CurrentTarget!=null)
	      {
	         Enemy.rotation =  Quaternion.Lerp(Enemy.rotation, Quaternion.LookRotation(new Vector3(CurrentTarget.transform.position.x, 0.0f, CurrentTarget.transform.position.z) - new Vector3(Enemy.position.x, 0.0f, Enemy.position.z)), EnemyRotationSpeed); 
	        
			 float CurrentDistance = Vector3.Distance(CurrentTarget.transform.position, Enemy.position); 
	         Vector3 structDirection = (CurrentTarget.transform.position - Enemy.position).normalized; 
	         float attackDirection = Vector3.Dot(structDirection, Enemy.forward); 
	         
			 if (CurrentDistance < WeaponMaxDistance && attackDirection > 0) 
	         {
 				 if (WeaponReloadTime > 0) WeaponReloadTime -= Time.deltaTime; 
		         if (WeaponReloadTime <= 0) 	
				 {	
					if(Network.isServer)
					CurrentTarget.networkView.RPC("TowerSetDamage",RPCMode.All,WeaponDamage);					
					WeaponReloadTime = WeaponReloadCooldown;
				 }
	         }
			 else
			 Enemy.position += Enemy.forward * EnemySpeed * Time.deltaTime; 	
	      }	
		  else
		  CurrentTarget = GetTarget();	
	
	

}

PS
If you do not put the gun or when the AI will destroy the gun, they cease to flash and before the new gun

In what could be the problem?

1 Answer

1

Solved the problem by removing NetworkRigidbody