Unity Animation: Can I Skip/Forward the played animation by touch? - c#

Halo guys, I'm literally new to C# on Unity. Can I ask some scripts if I may to you all. The case is somethings like this: I have an animation that played some sprites on a scene. I want to know if I can skip / forward the animation by touch using C# scripts placed on Empty Game Object. So the animation can move forward for 1 second / 2 seconds if the user touch the screen, so the animation more faster done playing or the user doesn't need to wait the animation that played to be finish.
I just think I may build that function with for statement and placed on void update. Please correct me if I'm wrong, and if I may put some code on you'r thought. Many thanks and cheers :).

Related

Maximo animation i dont want my character to move with it

I have imported some Maximo animations, but when i use them i see that the character moves with the animation. when i walk for example i want it to be done via code and not the animation. how can i do this?
my animation rig is set to Humanoid, and also to loop when it ends.
i have tried to check if i can find it in the animation window, and if i can see the changes but no result. i think its the animation itself that changes its position. so please help me find this out or help me find another software where i can create an animation without moving the player.
i am talking about walking/running animations i need a way to not move it via the animation but via my character controller script.
Pretty sure you just need to turn off root motion.
https://docs.unity3d.com/ScriptReference/Animator-applyRootMotion.html
Just pick your avatar and uncheck "Apply root motion", or you can change it via code if you prefer.

Unity Dota style loading screen

I'm creating a 3v3 multiplayer game and I'm stuck on an important part before the gameplay comes in.
I was wondering how you would approach creating a Dota 2 style loading screen for loading characters into the game (Picture below).
Creating the UI isn't the problem. The problem is animating it to look clean while also having it actually load the game (terrain/gameobjects/etc) with a progress bar or something.
I load the level with this
PhotonNetwork.LoadLevel('Game');
Then a gameobject spawns each player with
PhotonNetwork.Instantiate('....');
This works pretty well with nothing in the scene other than a plane to walk on. Now I just need to create the loading screen BEFORE the character loads while actually loading the terrain/objects/etc.
If anyone could point me in the right direction I would really appreciate it.
Thank you
Dota 2 style loading screen example:
I think this is a perfect case to use for Scriptable Objects in Unity.
Because as far as i remember there are around 100 heroes in Dota 2 and only 10 of them will be picked. So the images in this loading screen would change based on player input. Therefore, you should create scriptable objects. Then you can change the image(hero) also modify/add nick names to it in Run time. So to sum up you will have 10(in Dota but 6 is your case) scriptable object in your scene but you will only modify the images and nicknames after player selects the heroes.
Another benefit would be since they are objects you can easily animate them move up and down adjust however you want.
Here is a tutorial from Brackeys that is perfect for your case. Good luck!

How to allow movement while in animation (Unity)

I have a game I am making where I want that the player has no animations until it hits a certain trigger. Then I want a short animation to be played, then it will stop the animation again.
To get this effect I have the above animator state machine attached to my player, and when the player collides with the trigger it plays the Halfway animation, then it goes back to the empty state. All of this seems to work fine at first but while my player is in this empty state loop thing, I cannot move it. I am using "rb.velocity = new Vector3(stuff);" to move my player, and when I disable the animator component I can move fine. I was wondering if
There is any way to enable movement while I am in this empty state,
There is some way to get rid of the entry transition entirely so I don't have to have the empty state at all, or
Pretty much anything else that would make this work :P
If you need more information let me know, I will try and help you help me as much as I can. Thanks!

How to force repainting my scene?

I'm coding a script in Unity that is applying a sequence of motions to my camera, for it to follow a predefined path. I need to repaint the scene in between every small motion otherwise the scene is drawn only when it reaches its final position.
I tried a lot of options but I just can't find something working for me.
I already tried :
SceneView.RepaintAll();
HandleUtility.Repaint();
and it can't find the Repaint() method from the Editor or EditorWindow classes.
Any idea ?
rendering process start after each Update(). Let process your motion logic in several Update with interpolation between each update.

Animation unexpected behaviour - Why animation becomes complete If my camera walk through the scene

Maybe what I am going to ask you is unbelievable but It is my observation of Three days. I am unable to figure-out what is the problem. I have
asked my problem three times in different perspective but no luck.
Different but some kind (train) animation runs
at once on button click some animation complete on time while some not(play continuously-Don't know why). If I move my camera in the scene (a place where animation have to reach) then, my animation become complete but if I don't move or turn my camera then animation not complete even half hour passed.
I don't know what is the relation between camera and animation completion.
some things which I want to know
Why some animation complete on button click while the some not, even
the code is same and animation clips are right
Why those animation who play continuously, becomes complete as i walk
thorough my camera
What is relation b/w camera and animation play?
Is Train culling is the problem because i note that if i don't use the culling then, this problem occurring less(But occurring) as compare to train with culling.
Refer to my this question and answer. It were much disappointing that no one able to identify the problem (maybe lack of much attention to this question). After working 4/5 days finally I got this.
It were mainly animation Culling type Problem. For future use and help for the beginners like myself I am going to answer my own question here all questions are tightly associated with each other i.e., 1 answer to understand it:
Answer:
My animation culling type were selected to BasedOnRenderers which means that 'Animation is disabled when renderers are not visible'. i.e., my code were showing me that animation is playing but nothing acutal happening in my scene as my animation were far from camera view.
I solved this problem by selecting animation culling type to AlwaysAnimate (refer to this). It means that 'object is animated even when offscreen'.
Hope it will help others

Categories