Answer the question
In order to leave comments, you need to log in
How to switch between items in inventory[UNITY]?
Hello, how to make this switch?
1. There are 2 buttons "Right" and "Left". There are also 3 items (Let the 3d model of a car, bus, motorcycle)
2. First we have a model of a motorcycle. Pressing the "Right" button switches to the next model along with its information and so on. In the end, so ad infinitum.
An example of the well-known game Brawl Stars:
(there are buttons "right" and "left" in the photo, as well as information for each character. The whole mechanism is described above)
I would be grateful for the code or for the video tutorial. Thank you!
Answer the question
In order to leave comments, you need to log in
1. Create an array of required objects
2. Instantiate the required number of objects on the stage (let's say 3 out of 5). On the stage (1, 2, 3)
3. When pressed to the right, instantiate the next element from the array (4), and debuild the previous element (1). On the stage (2, 3, 4)
4. When you click to the left, the opposite is true: instantiate the previous element (5), and debuild the rightmost (3). On stage (5, 1, 2)
5. And then we just move the camera to the desired element, or we move the elements themselves so that they get into the camera
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question