Search Unity

help for prefab random

Discussion in 'Multiplayer' started by Raje, Nov 30, 2009.

  1. Raje

    Raje

    Joined:
    Oct 15, 2009
    Posts:
    14
    help me please for my question..

    i have a problem with the prefab, i cant get the random player for my game,. over here the engine said "index out of range",..

    the cronologies like this ,.. i have a level for my car,.. and i would like to randome player when client connect into server,.

    function MakePlayer() {

    // Randomize spawn point and instaniate a player.
    var tmps : GameObject[] GameObject.FindGameObjectsWithTag("Respawn");
    var i = tmps.length;
    i = Random.Range(0, i);
    Network.Instantiate(player, tmps.transform.position, tmps.transform.rotation, 0);

    for the Bold player i declare it in the variabel player prefab, in this case i point it to may car player,..and i have make a respawns empty obeject for 8 player ,..but in my game cant running,..why??


    please help me...
     
  2. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    What exactly goes wrong when you attempt to use this code?
     
  3. Raje

    Raje

    Joined:
    Oct 15, 2009
    Posts:
    14
    sorry for im not explain it..

    meaning, when i used that code,..the prefab crash with server and client while in acces it,..server and client use same prefab,..its ough to get random player right? or im wrong?.. any suggestion for me??