- Home /
This post has been wikified, any user with enough reputation can edit it.
Question by
sient · Nov 29, 2013 at 02:46 AM ·
editorserializationreloading
Detecting serialization reload in editor
Is there a good way to detect that Unity is about to reload assets before the reload happens? In essence, to be notified when Unity is moving all of the Mono state into C++ and then back?
It is pretty easy to detect it has happened after the fact;
[ExecuteInEditMode]
class UnitySerializationDetector {
[NonSerialized]
private object obj;
void Awake() {
obj = new object();
}
void Update() {
if (obj == null) {
Debug.Log("Assets reloaded");
obj = new object();
}
}
}
but is there a way to do it before the serialization happens?
Thanks
Comment
Answer by brzydal · Mar 22, 2016 at 10:21 PM
I am not sure if this is what you're looking for, have you tried this:http://docs.unity3d.com/ScriptReference/ISerializationCallbackReceiver.html
Your answer
Follow this Question
Related Questions
Serialize Texture3D 1 Answer
Show prefab/GO in viewport via script 1 Answer
Big Problem Serializing 0 Answers
Instantiating Prefabs through Editor Script 1 Answer
C# Reload Script 1 Answer