Hey guys!
So I have a simple Server and a client.
A spawner script to spawn objects over the network is on the map:
using UnityEngine;
using System.Collections;
using UnityEngine.Networking;
public class EnemySpawner : NetworkBehaviour {
public GameObject objectToSpawn;
private float t;
void Start () {
//t = Time.time + 15f;
}
public override void OnStartServer() {
t = Time.time + 15f;
}
void FixedUpdate () {
if (!isServer)
return;
if (Time.time > t) {
CmdSpawnObject();
t = Time.time + 15f;
}
}
[Command]
void CmdSpawnObject() {
GameObject go = GameObject.Instantiate(objectToSpawn, transform.position, Quaternion.identity) as GameObject;
NetworkServer.Spawn(go);
}
}
So it will actually spawn the object on the server however no clients will spawn the object ![]()
How can I fix this please?
PS: This spawner object has a network identity on it also.