Forum rules - please read before posting.

sprite library and adventure creator

edited May 23 in Technical Q&A

hi, has anyone managed to change categories through the action list?

my controller uses sprites unity complex; I'm trying to achieve a one-piece costume change, the sprite library is the only thing suitable for implementing this idea.

Comments

  • From what I understand, it's a case of applying an override to your Sprite Library - as covered by this example.

    To run either the AddOverride or RemoveOverride functions, a custom Action can be used:
    https://adventure-creator.fandom.com/wiki/Sprite_Libary_override_action

  • edited May 24

    @ChrisIceBox

    the user action has probably not been updated for a long time, there are several errors:

    line 21:

    'ActionSpriteLibraryOverride.category' hides inherited member 'Action.category'. Use the new keyword if hiding was intended.

    here I used the keyword

    line 73:

    The name 'hotspot' does not exist in the current context

    The name 'constantID' does not exist in the current context

    The name 'parameterID' does not exist in the current context

  • Try it now.

  • the custom action is working;

    my project uses player switching, so my player is in prefab. I put an action list on asset file on hotspot 2d to access the action list in the project, it works and my character can change clothes.;

    but I noticed that after the execution, the clothes do not change immediately, I need to press any key so that the character moves a little and his animator updates the texture.;

    am I doing the right thing or is there another way to use a custom action with player prefab?

  • I'm not sure I follow. At what point do you want to run the ActionList? Attaching it to a Hotspot isn't the only way to run it - the ActionList: Run Action can be used to run an ActionList asset.

    Place an ActionList: Comment Action before the custom Action to show some debug text in the Console. Is that being run at the intended time, and it's the custom Action itself whose effects are delayed?

  • edited May 28

    Place an ActionList: Comment Action before the custom Action to show some debug text in the Console. Is that being run at the intended time, and it's the custom Action itself whose effects are delayed?

    it is executed in time, the fact is that after that the character's sprite stands without clothes until it moves a little.

    I also noticed that the character's sprite "shakes" when moving towards the marker near the hotspot.

    at the root of the character's prefab in the sprite library component, the cassette file does not change to a new one, but nevertheless the character's costume changes, but it flashes when you walk

    I want to repeat this behavior.

  • If the Action is running at the correct time, then the behaviour is down to Unity's SpriteLibrary.AddOverride function.

    The tutorial you've linked to just swaps the SpriteLibraryAsset wholesale. The equivalent in code may be something along these lines, replacing the custom Action's Run function:

    public override float Run ()
    {
        if (runtimeSpriteLibrary == null) return 0f;
        runtimeSpriteLibrary.spriteLibraryAsset = spriteLibraryAsset;
        return 0f;
    }
    
  • edited May 30

    The equivalent in code may be something along these lines, replacing the custom Action's Run function:

    Yes, that's what I need, it changes outfits perfectly.


    but I still haven't been able to figure out why the character's sprite is shaking when movement towards the 2d marker is activated.

    in my project settings, the movement method is set to direct;
    tuning mode is set to snap;
    movement limitation is set to eight direction;

    Sprite tremors occur when the character is walking while leaning on the navmesh

    it looks like the character is walking diagonally, but for a second he tries to adjust his position vertically upwards, for example

    screenshots and videos of shaking:[REMOVED BY ADMIN]

  • Please do not share links that contain nudity or other NSFW graphics.

    You likely just need to enable "Angle snapping" in the Player's Inspector.

  • edited May 30

    You likely just need to enable "Angle snapping" in the Player's Inspector.

    Yes, it worked; very thx

    in any case, I need to get rid of blend three, smooth transitions spoil pixel graphics.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.