Change objects using script (170412)

Hi! I am a beginner at scripting, and i am starting to learn C# and Javascript, but i want to make a script and i don’t know how.

I have a “Character selection” scene for my game, and i have a few models and two arrows. I want to do something that changes some prefabs in the game when i press the right arrow.

Example:

There’s a guy with red shirt and blue jeans in the scene, and there is a image on canvas written “Guy 1”. I want to make something that when the player clicks on the right arrow, the guy changes to another one, with another image. Can someone help me? I would really appreciate if anyone could :smiley:

Actually, I use Sort to order them according to their position to the center and their angle within it. But, in very enclosed points the algorithm fails, and it order following their angle not their real position... So I was wondering If it was possible to achieve what I need by using 8-connectivity.

1 Answer

1

This is an incredibly vague question; rather than asking this sort of thing Unity Answers, which basically amounts to “please write this script for me” you should review the Unity UI documentation which will provide all the information necessary to implement this.