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. Dismiss Notice

Question Wrong buttons indexation in iOS build.

Discussion in 'Scripting' started by dimex472, Jun 25, 2020.

  1. dimex472

    dimex472

    Joined:
    Jun 18, 2020
    Posts:
    7
    There is a scene with a choice of levels. The indexing of the buttons (their serial number, the number of stars the player has and the level lock) is processed by the script. Full class code https://hastebin.com/punavadudi.cs

    Scene in play mode:

    When a scene is played in play mode, then all the buttons are correctly indexed, but when the project builds on an iPhone and starts on it, then this happens:

    iOS build:


    Also, I’m not sure of the correct approach to searching for objects by tag, and if someone has a better solution, I will listen with pleasure.
     
  2. WarmedxMints

    WarmedxMints

    Joined:
    Feb 6, 2017
    Posts:
    1,035
    Have a script for your buttons and set the level number in that script. Instead of referencing the gameobjects, find the instances of that script and use that to set each buttons details.

    Find Objects with tag isn't going to give you a set order each time.
     
  3. dimex472

    dimex472

    Joined:
    Jun 18, 2020
    Posts:
    7
    Could i do this with prefab somehow?