Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Bug Store prefab in ScriptableObject causes issue with event emitter in Timeline

Discussion in 'Scripting' started by Nuttaphoom, May 16, 2024.

  1. Nuttaphoom

    Nuttaphoom

    Joined:
    Jul 20, 2020
    Posts:
    26
    Sorry for my english in advance.'

    I have CharacterSheet SO that store a prefab represented the specific character.
    For example, character named Pear's character sheet will store reference to Pear game object like in the follow images.
    upload_2024-5-16_11-16-13.png

    and when the game combat start, the system will look for the every party member in player's team and Instantiate those character prefab
    upload_2024-5-16_11-19-34.png

    When any character attack, I play Timeline asset accordingly to the attack type ,and broadcast event signal to decrease enemy's HP
    upload_2024-5-16_11-27-10.png

    the problem is when I Instantiate character that I get from the CharacterSheet, the signal won't be sent at all. I try Debug.Log when ReceiveSignal() function is called like in the following image.

    upload_2024-5-16_11-29-44.png

    BUT
    Creating ScriptableObject that store reference to every character prefab and instiate them work fine

    upload_2024-5-16_11-31-49.png

    Even though the problem was solved (I guess) I don't really know what can possibily cause the issue and I would like some opinion from professional.
     
  2. Nuttaphoom

    Nuttaphoom

    Joined:
    Jul 20, 2020
    Posts:
    26