Unity Image Component for 2D Animation - animation

I'm developing a 2D game in Unity (Version 5.1.2) which has an animation.
The animation is generated by flipping through the sprites in the sprite sheet.
My problem is that the animation is playing as it should in the "Scene View" but not in "Game View".
I normally create animations by using the sprite editor and then drag & drop all the sprites on the screen (Scene View).
It creates a Sprite Renderer to switch the sprites but I would like the Image Component to flip through the sprites. It seems like only sprites in the Image Component is being displayed in the "Game View".
Is there any way I can get some assistance on this please.

Its really strange that you are only seeing that in your Scene View. If the animation is your default animation? Otherwise, make sure that you are sending the right parameters to your animator. A good way to test it is opening your Animator windows, checking all transitions, and manually filling the parameters to see how it works wile the game is running. Also, check if the transitions between animations has exit times and transition durations, and disable them.

Related

How to fix that shining buttons issue after compiling in Unity Canvas

I'm using some simple buttons in canvas in a 2D game, there is no light or i don't do anything via code for brightness of button. Buttons are shows normally in scene view, but these are shining in game view like putting a lights on them. What's the reason for this? How can i solve? You can see that what i mean on image below.
https://imgur.com/g0sQujE
I checked image attributes of buttons and camera render settings but didn't found anything.

which animation fits expandable container in flutter?

How to make a container a new page by making it full screen with animation?
I have seen the animation widgets and I tried to do that with animation container but I failed.( the problem was I couldn't make it full screen and I couldn't define animation I want)
Regards
Animation showed
here in Dribbble while dragging the container up.
( Doesn't matter dragging or tapping. just I want to know which tool should be used for the animation. )
If I got you right, the animation you are looking for is combination of SlideTransition and ScaleTransition.

Unity 2D animation seems blocked

I have an animation in Unity, its 2D, made from Sprites.
My animation is blocked, I mean, I can't add a new sprite, click play button, or add a new Property.
In order to animate an object in Unity you have to have a valid object selected, that is to say, the object can be animated.
This is typically a game object that is selected in the hierarchy.
Without this, how does the animation window know what it can and can't animate? That is the way that properties are animated in Unity, it needs to know what it is supposed to be animating, the valid object tells it what can be animated. Without this knowledge, the animation window will lock down certain features, adding keys and playing the animation.
In your case, select the game object that you want to have animated and, if you have a valid animator controller in place, the animation window will set itself up with all the necessary bits and pieces, namely the animation clips. Then you can animate to your hearts content.
Here's the animation window reference:
https://docs.unity3d.com/Manual/animeditor-UsingAnimationEditor.html
Hopefully this answers your question.

Unity Animation not working on different scene

I'm working on a menu scene where the options come down from top, so I tried to use Unity simple Animator. The problem is the animation won't work. The weird part is, when I tried the same thing on my game scene the animation works.
-I've checked that the animation is attached to the object
-Culling type is Always Animate
-I've also added a script and tried to force the animation with no results.
Why doesn't the animation not working anything other than the main scene? Do I need to trigger something for it to work?
Things you could check:
Make sure you are using the same kind of component in both scenes. Animator is different from Animation.
If you have an Animator component make sure you have an the right Animation Controller attached to it.
If you have an Animation component make sure that the Animation field is set and holds your animation file and Animations is set too and holds the list of possible animations of your (UI) object.
Even though they have the same extension, .anim files created when an Animation component is attached are different from .anim files created when an Animator component is attached so if you try to play an Animator .anim it won't play with an Animation component.
Is your Animation set to play automatically? If not, are you giving the animation.Play() command somewhere in your code?

Unity 3d show specific frame of animation

I'm trying new unity 3d options for 2d games. I'm trying to create background that changes depending on actions i made. So if i press button one i get sprite one as background and if two i get sprite two. Since I have 32 options, I figure out the best way would be to have an Animator, that changes frame depending on button click. So i created animator and animation. But the problem is I can't set time to where to stop animation to show selected frame.
I'm trying like that:
Animator ani=background.GetComponent<Animator>();
ani.animation["field_back_anim"].time=0.5f;
ani.speed=0;
But it fails at second line with that error:
MissingComponentException: There is no 'Animation' attached to the "background" game object, but a script is trying to access it.
You probably need to add a Animation to the game object "background". Or your script needs to check if the component is attached before using it.
However if I do no code the animation just plays trough all 16 frames. So i gues there is animation after all.
On the background GameObject I have 2 components first is sprite renderer and second is animator. When I open animator in Animator view i see there green rectangle saying Any state and yellow one with "field_back_anim". I don't get what i'm doing wrong.
I will also except any other solution that does the following.
Thanks!
The animator component is used to control transition between many animation clips. If you're going to playing an animation clip on a gameobject, an animation component is proper, not the animator. Remove the animator and add an animation component to your background gameobject in the inspector. If you set animation property to field_back_anim, your gameobject will animate well. Manipulation codes should be changed like below.
Animation ani = background.GetComponent<Animation>();
ani["field_back_anim"].time = 0.5f;
ani["field_back_anim"].speed = 0;

Resources