- Home /
Changing images within a scene
Hello all,
I am trying to create an interface with unity. It needs to display image within an interval of 3 seconds with alternating breaks between display of images. For eg:- If img1 is shown for 3 seconds, then there is a gap of about 1 seconds and at that time it should display an empty scene (Or like a scene with one dot at the center). Then proceed with img 2 and again gap (Dot at center for 1 seconds) and so on.
How do i achieve this method ? Should i use different scene for every images or make them use as a sprite ? Also, if i make them use as a sprite how to make this transition continuously ?
Thanks
Answer by rainChu · Aug 19, 2018 at 07:09 AM
You should use a single scene and use a sprite. You can do everything you want, at least as far as the actual animation goes, using Unity's built-in Mecanim animation system. Look up how to use the Animator component. The Animator is not just used for characters, but also for UI and simple sprites. It can be used any time you have something that needs to change over time.
You need the following:
A GameObject for your sprite, with an Animator on it, and some different images, as sprites as child GameObjects.
One or more Animation assets which tell your game how to slide or toggle between the images, and which images to go to.
An AnimatorController asset which tells your game which Animation to play and when. All you need in your case is just a single animation that autoplays.
Be sure to consult the manual on how to do this, it's an excellent resource. There are probably also plenty of videos on YouTube showing how to create simple animations within Unity.
If you need more help, respond in a comment and I'll try my best to fill in the blanks. Good luck!
Your answer
Follow this Question
Related Questions
How to Create an array of images? 1 Answer
Greyscale Image 1 Answer
Unity News feed 1 Answer
Download and save images into local phone storage makes the app hang 1 Answer
Filling blind spots in raycast cone? 0 Answers