#make a thread while you're at it so its
1 messages · Page 1 of 1 (latest)
Debug.Log the name of clip that supposed to call animation.Play
Debug.Log(animation.name)
also you should check the animator while the object is selected in playmode to see exactly what happens
hmmm nothing shows even when I added debug.log
using UnityEngine;
public class MoveExecutor : MonoBehaviour
{
[SerializeField] private MoveAnimationMapping animationMapping;
[SerializeField] private Animator animator;
public void ExecuteMove(MoveBase move)
{
AnimationClip animation = animationMapping.GetAnimationForMove(move);
if (animation != null)
{
animator.Play(animation.name);
}
else
{
Debug.LogWarning($"No animation found for move: {move.Name}");
Debug.Log(animation.name);
}
}
}
btw if I change animation.name to anything it shows an error
why did you put the log in the else statement?
so that if it doesn't work it will show me
thats not the purpose of the log.
if its null why would you have a name
thats nonsense
oh right didn't think that
put it before the Play
using UnityEngine;
public class MoveExecutor : MonoBehaviour
{
[SerializeField] private MoveAnimationMapping animationMapping;
[SerializeField] private Animator animator;
public void ExecuteMove(MoveBase move)
{
AnimationClip animation = animationMapping.GetAnimationForMove(move);
if (animation != null)
{
Debug.Log($"Executing animation: {animation.name}");
animator.Play(animation.name);
}
else
{
Debug.LogWarning($"No animation found for move: {move.Name}");
}
}
}
is this good?
btw still shows nothing in the console
show where you put the code
where I put the code?
yes like is the code running
put Log also before If statement and log animation
if no logs are printing after that, the code isnt running
or you have logs hidden
I put it in vsc
mate
in battlesystem component
so the function isnt running ?
put logs on the first line of the function, if its not called ofc its not gonna animate.
I think so
no there is nohing to think about. put the logs and test
which log to put tho?
thats what the logs are for
for testing?
public void ExecuteMove(MoveBase move)
{
Debug.Log($"looking for animation based on move", this);
AnimationClip animation = animationMapping.GetAnimationForMove(move);
Debug.Log($"did we find animation ? {animation}", this);
if (animation != null)
{
Debug.Log($"Executing animation: {animation.name}");
animator.Play(animation.name);
}
else
{
Debug.LogWarning($"No animation found for move: {move.Name}");
}
}```
added your code but still no log
then what do you think that means?
could mean the logs are disabled but checked it and it is enabled Idk rn what is the error
no. try again. Why do you think nothing is printing ?
if you run the game, why is it not priting ?
assuming you saved the new changes in the file
ExecuteMove has the first line with the log
nothing stopping from printing the log
why do you think its not printing though?
its really not that hard of a guess
it means ExecuteMove is clearly not called
or the code is not running
so how do you call ExecuteMove
where to use it tho?
soundss like you need to start back from the c# basics again frankly
no just kidding I do use it in the battlesystem
seems pretty logical where to call it because its going to be your game, you need to figure it out. If you cannot you need to make a simpler game first
ask yourself those questions.. Where do I need to call it, what is it for ?
you just copied it with 0 clue on what it even does probably
you cannot advance if you use code you don't understand
frankly I don't have time to tutor on this issue, so if you need specific help I'll help you but I cannot tell you how to build your game
no I did implement it in battle system script
@wheat venture I got the log
Executing animation: scratch
UnityEngine.Debug:Log (object)
MoveExecutor:ExecuteMove (MoveBase) (at Assets/Scripts/Pokemon/Moves/MoveExecutor.cs:17)
BattleSystem/<PerformPlayerMove>d__13:MoveNext () (at Assets/Scripts/Battle/BattleSystem.cs:64)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)
but it still doesn't work with move
hello?
wdym doesnt work with move?
like it still doesn't show when I use move
so does it work with scratch?
no it starts when the battle starts and ends as well but it doesn't display the animation when I select the move scratch
if its being called you need to check the Animator and see if its receiving the animation
yes it is as it is being played
so it working?
No like it starts when the animator component is on not when scratch is selected
Idk what the error is as it does not show up when selecting scratch
Mind taking a look at the animation?
what do you mean by this?
Like the animation starts and ends and then when I select scratch the animation does not play
which animation ?
because you have play on awake with transitions
if you plan on calling Play then you should not use transitions
This one
But it is for battle enter animation and is required
I think it's an issue with the animation what do you think?
Hello?