Page 1 of 1

SetPortrait() using Addressables

Posted: Fri Apr 11, 2025 5:02 pm
by NicoMozes
Good morning Tony,

Happy Saturday! I trust you are very well.

Im trying to change sprites using the sequence SetPortrait([var=Actor], MC), while using addressables.

In the past, this has worked perfectly without addressables. I had my sprites in the Resources Folder, and calling this sequence work perfectly.

Now, the portraits are not being updated.

I have the USE_ADDRESSABLES ADDED, and when debugging the system, it all looks normal:

Code: Select all

Dialogue System: Sequencer: SetPortrait(Kyrian, MC)
UnityEngine.Debug:Log (object)
PixelCrushers.DialogueSystem.Sequencer:HandleSetPortraitInternally (string,string[]) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:2563)
PixelCrushers.DialogueSystem.Sequencer:HandleCommandInternally (string,string[],single&) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:1223)
PixelCrushers.DialogueSystem.Sequencer:ActivateCommand (string,string,UnityEngine.Transform,UnityEngine.Transform,string[]) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:837)
PixelCrushers.DialogueSystem.Sequencer:PlayCommand (PixelCrushers.DialogueSystem.SequencerCommands.QueuedSequencerCommand,string,bool,single,string,string,string[]) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:798)
PixelCrushers.DialogueSystem.Sequencer:PlayCommand (PixelCrushers.DialogueSystem.SequencerCommands.QueuedSequencerCommand) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:762)
PixelCrushers.DialogueSystem.Sequencer:PlaySequence (string) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:696)
PixelCrushers.DialogueSystem.Sequencer:PlaySequence (string,bool,bool) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:706)
PixelCrushers.DialogueSystem.ConversationView:StartSubtitle (PixelCrushers.DialogueSystem.Subtitle,bool,bool) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:200)
PixelCrushers.DialogueSystem.ConversationController:GotoState (PixelCrushers.DialogueSystem.ConversationState) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Controller/ConversationController.cs:249)
PixelCrushers.DialogueSystem.ConversationController:OnFinishedSubtitle (object,System.EventArgs) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Controller/ConversationController.cs:318)
PixelCrushers.DialogueSystem.ConversationView:FinishSubtitle () (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:441)
PixelCrushers.DialogueSystem.ConversationView:HandleContinueButtonClick () (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:413)
PixelCrushers.DialogueSystem.ConversationView:OnConversationContinue (PixelCrushers.DialogueSystem.IDialogueUI) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:392)
UnityEngine.Component:SendMessage (string,object,UnityEngine.SendMessageOptions)
PixelCrushers.DialogueSystem.AbstractDialogueUI:OnContinueConversation () (at Assets/Pixel Crushers/Dialogue System/Scripts/UI/Abstract/Dialogue/AbstractDialogueUI.cs:375)
PixelCrushers.DialogueSystem.AbstractDialogueUI:OnContinue () (at Assets/Pixel Crushers/Dialogue System/Scripts/UI/Abstract/Dialogue/AbstractDialogueUI.cs:365)
PixelCrushers.DialogueSystem.StandardUIContinueButtonFastForward:OnFastForward () (at Assets/Pixel Crushers/Dialogue System/Scripts/UI/Standard/Effects/StandardUIContinueButtonFastForward.cs:86)
UnityEngine.EventSystems.EventSystem:Update () (at ./Library/PackageCache/com.unity.ugui/Runtime/UGUI/EventSystem/EventSystem.cs:530)
Am I missing a step into using addressables?

When I untick the setting and move back the images to Resources, the sprites get updated correctly.

Thanks in advance!

Cheers,
Nico

Re: SetPortrait() using Addressables

Posted: Fri Apr 11, 2025 11:01 pm
by Tony Li
Hi Nico,

Addressables got a little more permissible about loading textures and sprites in recent versions. If you're using a recent version of the Addressables package, please use this patch, which contains an update that will be in DS 2.2.52.

DS_AddressablesPortraitPatch_2025-04-11.unitypackage

(The issue is that requesting to load a Sprite asset from Addressables will also load Texture2D assets now, but the previous SetPortrait() command was set up to handle them separately, so the logic missed the fact that the texture got loaded in the request to load a sprite.)

Re: SetPortrait() using Addressables

Posted: Sat Apr 12, 2025 1:15 am
by NicoMozes
Perfect. That fixed it!

Thank you and have a great weekend!

Nico

Re: SetPortrait() using Addressables

Posted: Sat Apr 12, 2025 8:29 am
by Tony Li
Glad to help! You have a great weekend, too!