Wednesday, February 21, 2018

How to iterate over 25 Sprite Objects (Unity 5 - C#)


I wanna show a minimap on the screen. The minimap would look like this (bottom right corner, this was done time ago in Visual Studio):


Minimap


Have two problems with that, I have 25 Image objects created in the scene and 25 in the playercontroller script:


public Image minimap0, minimap1, minimap2, minimap3, ... , minimap24; 


but I can't make to change its sprite, and also, I don't know how to change all 25 objects sprite with a "for" loop (the foor will look like this http://imgur.com/qfi1Ht1 ).


The map is stored in an array for checking positions.




No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...