#make a thread while you're at it so its

1 messages · Page 1 of 1 (latest)

rugged rune
#

ok

#

I have showed the entire setup

wheat venture
#

also you should check the animator while the object is selected in playmode to see exactly what happens

rugged rune
#

hmmm nothing shows even when I added debug.log

rugged rune
# wheat venture Debug.Log the name of clip that supposed to call animation.Play `Debug.Log(anim...

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);
        }
    }
}
wheat venture
#

why did you put the log in the else statement?

rugged rune
#

so that if it doesn't work it will show me

wheat venture
#

thats not the purpose of the log.

#

if its null why would you have a name

#

thats nonsense

rugged rune
#

oh right didn't think that

wheat venture
#

put it before the Play

rugged rune
#
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?

rugged rune
wheat venture
rugged rune
wheat venture
#

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

rugged rune
#

I put it in vsc

wheat venture
#

mate

rugged rune
#

in battlesystem component

wheat venture
#

your console window

#

show it

#

in playmode when the function is supposed to run

rugged rune
#

ok brb

wheat venture
#

so the function isnt running ?

#

put logs on the first line of the function, if its not called ofc its not gonna animate.

rugged rune
wheat venture
#

no there is nohing to think about. put the logs and test

rugged rune
#

which log to put tho?

wheat venture
#

thats what the logs are for

rugged rune
wheat venture
#
 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}"); 
        }
    }```
wheat venture
#

its in the name

rugged rune
wheat venture
rugged rune
#

could mean the logs are disabled but checked it and it is enabled Idk rn what is the error

wheat venture
#

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?

rugged rune
#

hmm I really don't know

#

I checked everything

wheat venture
#

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

rugged rune
#

nowhere

#

I think this is the error

rugged rune
wheat venture
#

soundss like you need to start back from the c# basics again frankly

rugged rune
#

no just kidding I do use it in the battlesystem

wheat venture
#

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

rugged rune
#

@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?

wheat venture
#

wdym doesnt work with move?

rugged rune
#

like it still doesn't show when I use move

wheat venture
#

so does it work with scratch?

rugged rune
#

no it starts when the battle starts and ends as well but it doesn't display the animation when I select the move scratch

rugged rune
wheat venture
rugged rune
wheat venture
#

so it working?

rugged rune
#

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

rugged rune
rugged rune
wheat venture
#

because you have play on awake with transitions

#

if you plan on calling Play then you should not use transitions

rugged rune
rugged rune
#

I think it's an issue with the animation what do you think?

rugged rune