docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface IConditionSerializationCallbackReceiver

    Interface for conditions use by Behavior nodes that need to handle custom serialization/deserialization logic. Implement this interface on condition classes that contain state which cannot be automatically serialized, or that need to pre-process data before serialization.

    Note: These callbacks are only invoked for conditions that are part of a running node. Standard runtime registration logic should still be implemented in the Condition's OnStart/OnEnd methods.

    Namespace: Unity.Behavior
    Assembly: Unity.Behavior.dll
    Syntax
    public interface IConditionSerializationCallbackReceiver

    Methods

    OnDeserialize()

    Called after a graph containing this condition is deserialized. Use this method to:

    • Restore runtime state that cannot be directly serialized
    • Rebind references or listeners
    • Rebuild caches or re-initialize condition state based on the deserialized data
    Declaration
    void OnDeserialize()

    OnSerialize()

    Called before a condition is serialized. Use this method to prepare data for serialization, such as converting complex runtime data into serializable formats or caching state information.

    Declaration
    void OnSerialize()
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)