# Questions about SerializeState/UnserializeState

**URL:** <https://iplug2.discourse.group/t/questions-about-serializestate-unserializestate/103>\
**Category:** Uncategorized\
**Created:** [4 June 2020 07:40 UTC](https://iplug2.discourse.group/t/questions-about-serializestate-unserializestate/103 "2020-06-04T07:40:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SugarAudio](https://avatars.discourse-cdn.com/v4/letter/s/97f17d/32.png) [@SugarAudio](https://iplug2.discourse.group/u/SugarAudio)\
**Post date:** [4 June 2020 07:40 UTC](https://iplug2.discourse.group/t/questions-about-serializestate-unserializestate/103/1 "2020-06-04T07:40:28Z")

</div>

Good morning, I have a couple of questions:

- should overridden Unserialize/SerializeState methods be in IPLUG\_DSP, IPLUG\_EDITOR or global block ?
- is any method in the UI/Editor thread called when a state has been un-/serialized, OnRestoreState look promising?
- is IGraphics attached when all these methods are called ? (Seems not always)
- may I call SendControlValueFromDelegate/SendArbitraryMsgFromDelegate from Unserialize/SerializeState methods to send an info to the UI/Editor ? Or what would be the right way to update the UI after unserializing custom data ?

Thank you !

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [4 June 2020 10:37 UTC](https://iplug2.discourse.group/t/questions-about-serializestate-unserializestate/103/2 "2020-06-04T10:37:37Z")

</div>

> [@SugarAudio](#):
>
> should overridden Unserialize/SerializeState methods be in IPLUG\_DSP, IPLUG\_EDITOR or global block ?

first a reminder that IPLUG\_EDITOR/IPLUG\_DSP guards are only needed if you want to make a Web Audio Module, or a “distributed” VST3 plugin, other formats you don’t need to worry about these guards and it can make your code cleaner to remove them. The Unserialize/SerializeState methods need to exist at global level for the case of a “distributed” VST3 plugin, where the VST3 processor and controller need access to the state. I would advise against making a distributed VST3 at this stage if you don’t have a good reason

> [@SugarAudio](#):
>
> is any method in the UI/Editor thread called when a state has been un-/serialized, OnRestoreState look promising?

OnRestoreState() \* i think \*… been a while

> [@SugarAudio](#):
>
> - is IGraphics attached when all these methods are called ? (Seems not always)

Not necessarily

> [@SugarAudio](#):
>
> may I call SendControlValueFromDelegate/SendArbitraryMsgFromDelegate from Unserialize/SerializeState methods to send an info to the UI/Editor ? Or what would be the right way to update the UI after unserializing custom data ?

Yes those methods would be appropriate. Also SendControlMsgFromDelegate()
