Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Bug on Tournamente mode.

Discussion in 'Editor & General Support' started by EdgarCarrera, Jun 14, 2016.

  1. EdgarCarrera

    EdgarCarrera

    Joined:
    Apr 21, 2014
    Posts:
    255
    Hello guys i'm making a racing game like mario kart or something. and i added a tournament system but wen i go to the next map look what happend.

    so my problem is. first map all ok. next map 64 user instantiate.

    in the first map the instantiate is random place. on the next map the instantiate is on ur last map position.

    instantiate code:
    Code (CSharp):
    1.  
    2.                if (gm.cupMapsInfo[1].isPlayed) {// [B]Loading next map[/B]
    3.                     for (int p = 0; p < gm.PlayersInTournament.Count; p++) {
    4.                         int tempPosition = gm.PlayersInTournament [p].Position - 1;
    5.                         if (!PlayerIsDone) {
    6.                             GameObject tempPlayer = (GameObject)Instantiate (Resources.Load ("Player"), spawnPoints [tempPosition].position, spawnPoints [tempPosition].rotation);
    7.                             tempPlayer.GetComponent<KartInterface> ().spawnRotation = spawnPoints [tempPosition].rotation;
    8.                             PlayerIsDone = true;
    9.                             tempPlayer.transform.parent = GameObject.Find ("_ Players").transform;
    10.                         }
    11.  
    12.                         if (i != randomPos && curSpawn < spawnPoints.Length && PlayerIsDone) {
    13.                             GameObject tempPlayer = (GameObject)Instantiate (Resources.Load ("NPC_Player"), spawnPoints [tempPosition].position, spawnPoints [tempPosition].rotation);
    14.                             tempPlayer.GetComponent<KartInterface> ().spawnRotation = spawnPoints [tempPosition].rotation;
    15.                             tempPlayer.transform.parent = GameObject.Find ("_ Players").transform;
    16.                         }
    17.                     }
    18.                 } else {// [B]Loading FIRST map[/B]
    19.                     if (!PlayerIsDone) {
    20.                         GameObject tempPlayer = (GameObject)Instantiate (Resources.Load ("Player"), spawnPoints [randomPos].position, spawnPoints [randomPos].rotation);
    21.                         tempPlayer.GetComponent<KartInterface> ().spawnRotation = spawnPoints [randomPos].rotation;
    22.                         PlayerIsDone = true;
    23.                         tempPlayer.transform.parent = GameObject.Find ("_ Players").transform;
    24.                     }
    25.  
    26.                     if (i != randomPos && curSpawn < spawnPoints.Length && PlayerIsDone) {
    27.                         GameObject tempPlayer = (GameObject)Instantiate (Resources.Load ("NPC_Player"), spawnPoints [i].position, spawnPoints [i].rotation);
    28.                         tempPlayer.GetComponent<KartInterface> ().spawnRotation = spawnPoints [i].rotation;
    29.                         tempPlayer.transform.parent = GameObject.Find ("_ Players").transform;
    30.                     }
    31.                 }
    32.  
    Starting Map 01;

    1.jpg

    Players instantiate:

    2.jpg

    Starting Map 02:

    m2.jpg
    Players Instantiate (Like 64 players)

    3.jpg


    i try everything and idk what happend that. if u can help me please?
     
  2. EdgarCarrera

    EdgarCarrera

    Joined:
    Apr 21, 2014
    Posts:
    255