- Home /
Question by
Konkor4 · Dec 11, 2012 at 04:35 AM ·
instantiatenetwork
How to use Network.Instantiate?
I'm trying to spawn an object and set it's location/rotation to that of another object. But it's not showing up at all?
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour
{
public Transform spawnPrefab;
public Transform distancePrefab;
void OnConnectedToServer() {
Network.Instantiate(spawnPrefab, distancePrefab.position, distancePrefab.rotation, 0);
}
}
Comment
What do you mean it isn't showing up at all? Are there any errors, are you connected to a server, does this GameObject have a NetworkView attached?
There are no errors at all, it's not being created in the scene manager. I've started the server and it loads up the map, if I connect it says players are connected but it doesn't create a new item in the manager.
I have an item that spawns NPC characters, I've placed it under the map but it has child items that are set as spawn points which are also under the map. But I just can't seem to see any new items created at all.