Animation in Unity is repeated 2 times - unity3d

I have an animation which plays when I activate trigger "shoot". When it activate, animation plays 2 times. If I change Transition duration, it either it is not played at all, or it is played twice.
Pls, help me. I work on Unity 2020.3.0f1. My english is not very well, sorry
UPD: OMG I find a path to fix it. You need to check is your animation running, and if it isnt - you can run it. Use GetCurrentClipInfo

Maybe your animation is on loop. Check that.

Related

player animation starts from first bug

hello iam using a blendspace to make an animation the blend space repeats itself from the start as shown
and when i try to run the player animation bugs and starts from start as shown
what should i do?
link videos below
https://drive.google.com/file/d/1g3W7U5u5kLqCVigjUavMNUBOiYsq-Mf2/view?usp=sharing
https://drive.google.com/file/d/1fRsgRCJmd8_9k2X7MlUuz524gpFXQL8A/view?usp=sharing
nothing i don't know what to do
The problem could be the way you imported animation. If you download animations from website like mixamo.com and you don't want it to loop, make sure you check "In place" option.

Sound plays even though on awake is unticked unity

I looking into similar threads with this issue and sadly my issue is not being resolved how theirs was. I have a sprite that when it is collected a sound is played. As soon as the game starts any audio I attach is playing. I have deleted the sprite and remade it and the issue is still the same, however for my 7 other sprites there is no issue.
Does anyone know why this may be an issue?
If needed i can supply code however i don't think it is a code based issue
I had the same issue, old post but I didn't see my solution anywhere else. I found that the default script in the audio source game object was playing the clip in the start method. By commenting this out, I was able to stop it from playing when the game was started.
There is a chance that your audio source has a box named "Play On Awake" ticked.
I was looking for the same answer, as my audio sources also played when starting the game. After reading this question, somehow I realized there was a box ticked which I didn't bother looking over.
If your box is not ticked, then try writing in the Start method:
this.yourAudioSource.playOnAwake = false;

animateWithDuration stops animate

My code uses animateWithDuration in few places.
Everything works fine and the animation plays alright for a while, but - sometimes the screen suddenly freezes for half second and all the animation in all views stops play.
Means - the objects animation effected, but it ignores the duration or delay parameters.
I really guess it is up to some background processes, but I am really not sure about it.
In some places in code I use animateWithDuration inside methods that run under performSelectorOnMainThread, but it does not make a difference.
I'd be glad to hear ideas of why it happens and how to fix it.
Thanks in advance.

iPhone Pause CAAnimation from app enter background and retrieve

I've been reading functions of how to pause CAAnimation at:
https://developer.apple.com/library/ios/#qa/qa2009/qa1673.html
And it works great! Apart from when I tap the home button to make the app to background(which I did use the same pause technique for applicationWillResignActive)
However, it happens that the animation seems completely erased rather than its nice pausing.
Any suggestion of how to solve this issue?
It sometimes also happens that the storyboard seems restart the entire app from beginning?
I've used the technique from that link to pause animations and it works perfectly.
However, based on a little testing, it looks to me like the system kills running CAAnimations when your app goes to the background. If you want to resume the animation where it left off, you would have to recreate the animation(s) and set the beginTime parameter to a value that offsets into the animation. I haven't done that, so I couldn't tell you exactly how to do it without doing some tinkering.

Making fire effect on iPhone

I'll describe ways that I already know, and can do, and want to hear another suggestions, or may be even solutions :)
Create N frames of fire with semi-transparent pictures (PNGs)
Like at this site
Create pixel-based fire - line by line with shifting up. (not the best way I think)
Like here
Any other solutions?
Mr.doob's fire effect in flash is very clever.
Particles Fire Prototype by Nicolas Goles
Chapter 7 of iPhone Games Projects begins with a discussion of fire effects.
A movie with the fire animation playing, or maybe an animated .gif image.