I have a class that contains a List of GameObjects called Characters which are set during design. The GameObjects are prefab images.
I use the following line of code to instantiate the initial image:
Instantiate(Characters.Image.GetComponent<Transform>(), CharacterImage.position, Quaternion.identity, CharacterImage.transform);
I then have a button to click to advance through the list. What I’d like to have happen is the old animation to be replaced by the next animation in the List.
What happens is that it keeps creating the animations one on top of the other.
I then attempted:
but then the next image in the list can’t load (or at least it doesn’t show…even with another call to instantiate.
So in short…I have a list of a class that contains an animation GameObject. I would like to click a button and display the corresponding animation from that list while removing the previous animation from the screen.
This is all in the UI, btw.
Here’s a screen shot of the inspector for the class where I set the animations for the List.
Any help appreciated