Search Unity

Spawn modified prefab

Discussion in 'Multiplayer' started by U-GeeN, Dec 20, 2016.

  1. U-GeeN

    U-GeeN

    Joined:
    Mar 22, 2015
    Posts:
    95
    I am trying to spawn my playerprefab as npc so it has the "npc" tag and disabled InputControl.
    Something like this:
    Void SpawnBall () {
    GameObject npc = (GameObject)Instantiate (playerPrefab, position, rotation);
    npc.tag = "npc";
    npc.GetComponent<UserControl>().enabled = false;
    NetworkServer.Spawn (npc);
    }
    Still the client spawns the original playerPrefap.
    What am I doing wrong?
     
  2. LittleRainGames

    LittleRainGames

    Joined:
    Apr 7, 2016
    Posts:
    97
    Well if you look at your instantiate line, you choose the playerPrefab for the object you're spawning.