GraveYardJokes

  • 17 nov. 2022
  • Inscrit 31 août 2018
  • Thanks for the info. I'm not sure why but the code doesn't seem to be working for me. I fixed the type having the same name as the variable and now I'm not getting any errors, the event just doesn't fire. I'm going to try setting up a spine character with events in a new project and see if it works.


    Update: Event IS firing in new project. Now Maybe Ill update the spine runtimes


    Update: I fixed the Event not firing. Silly me did not update the Referenced animation when I remade my player pre-fab. So the event I was trying to fire was on a different copy of the animation that actually had the event on it. Silly me, but it's working well and now I can use Events how I want. Thanks for helping.

  • Hello,

    I was wondering if I could get some help understanding how to subscribe to events. I currently am trying to subscribe to an Attack event in my character's attack animation. I set it up in Spine properly. I just am not getting a reading on the event when I subscribe in unity. Note: the animation start and end fire, just not the attack.

    [SerializeField]
    private SkeletonAnimation SkeletonAnimation;
    [SpineEvent] public string attackEventName = "Attack";

    protected override void Start()
    {
        SkeletonAnimation.AnimationState.Event += AnimationState_Event;
    
        SkeletonAnimation.AnimationState.Start += AnimationState_Start;
        SkeletonAnimation.AnimationState.End += AnimationState_End;
    }

    private void AnimationState_End(TrackEntry trackEntry)
    {
    Debug.Log("End");
    }

    private void AnimationState_Start(TrackEntry trackEntry)
    {
        Debug.Log("End");
    }
    
    private void AnimationState_Event(TrackEntry trackEntry, Spine.Event e)
    {
        if (e.Data.Name == attackEventName)
        {
            Debug.Log("Fired!");
        }
    }  

    Further investigation I found that I had the variable SkeletonAnimation type the same way as the type name. I now am getting a null reference on "SkeletonAnimation.AnimationState.Event += AnimationState_Event;". So now I know the object is not connecting with the Event. Any pointers on what to do here to display a Debug.Log("Attack Fired!") in the console when the event fires?

  • So you were correct... I'm getting back into the process of working with spine again! I dragged and dropped the images onto the attachments and this set the correct path for me. I'm not completely sure why the paths are not automatically set with the script. Maybe it's something I'm doing in the export process? But your comment helped by pointing out the attachments!!! thank you!! 🙂 🙂 🙂

  • Can anyone help me understand why I'm having issues loading the images for spine. The project is just a crystal, and for some reason, the images don't want to show up. I used photoshop to spine script. The images icon in the spine hierarchy are all their and I can view the images if I hover over them. Also, note that the Images Icon has an orange tint in the upper right-hand corner... I know they need to show green but I'm unsure what I'm doing wrong. The path is set correctly. :think: :think: :think: