In Unity, there are many animation clips on one sprite target. The transition has been learned on the animator panel. However, the SPUM
, which is adopted for making various type of character with one paid asset, contains the animation switch in the script. Utilizing the script, I have implemented the animation based on the state.
// StateMove.cs
public class StateMove : StateBase
{
public override void Enter()
{
...
GetComponent<SPUM_Prefabs>().PlayAnimation("Run");
}
...
}
With the style of upper code snippet, I made the animation control acccording to the state without invoking transition arrow on the control panel. It is regarded as the best choice when the problem hadn't occured. The Attack
animation was invoked on the Enter
method on StateAttack
. Consequently, the attack animation can be seen when I press the attack key during the animation end. The problem is that the attack animation canceled at the end of press. with the this behaviour, we can implement cancel system or just fix it ASAP.
The InputSystem
on Unity can utilize the input with various devices either the UI joystick. The script for that purpose is included in the package. The OnScreenStick
is one of the script which I need for the input. Applying the script, there are also one more things to be attached on the player. The OnScreenStick
only works for the conversion of UI interaction to InputAction. I need to connect the input action to the behaviour. So I modified the InputMove
script to contains the connection; addition of joystick on the keybindings. Finally I see the joystick movement which linked with the player.