Problem with build but not in Unity

Hello everyone,

For my game i use an array to active blue and green cases on a grid.

It’s work very well on unity but when i build it on android (or on mac), it’s a mess and the localisation of the case or not the same. Like if the order of element in the array was not the same.

There is no logic with the generation oh the cases and i don’t understand.

The image attached give more informations.

Can you help me?

Thank you.

How are you taking your green and blue int arrays and turning that into green and blue squares onscreen? Are you using something like GameObject.FindObjectsOfType to get an array of objects to populate? That could be your problem as that method has no guarantee of a particular ordering.

1 Like

Yes i think it’s the problem, i use FindGameObjectsWithTag and i understood that it’s a correct method if you don’t want a precise order. But i don’t understand why it’s work on 2 ways depending of the platform.

So now i search a good solution to sort my arrays. Maybe if i use List it’s going to be more easier to change the index.

Thank you for your reply.

I just ran into this same problem too. The code works great in unity and the GameObjects are in order. But on Android they are just random. Thanks for pinpointing where my problem is.

What solved it for me was I had more than one object with the “Player” Tag and making it so only one object was using that fixed it. I also converted my array to a list and that didn’t help until I did the tag change.