Search Unity

Question Serialize Reference Examples and Use Cases

Discussion in 'Scripting' started by as3mbus, Jul 12, 2020.

  1. as3mbus

    as3mbus

    Joined:
    Dec 5, 2016
    Posts:
    71
    I was excited reading serialize reference capability to work with interface. i thought i could simply assign a unity object that implement such interface to a component. and save it within a scene / prefab. it would make polymorphism implementation in unity much more flexible.

    not until i read a line about :
    - The field type must not be of a type that specializes UnityEngine.Object.
    which destroy most of my expectation, and left me with confusion. so where does this serialize reference would serve me well ? i've read serialize reference attribute thread and found out that it might be more related with editor scripting or so. but i still having hard time to see where i can implement this attribute effectively and actually add this tool to my tool belt to use with confidence.

    would love to know any example use case that people like to share about this to kickstart my understanding about serialize reference attribute.

    sorry if it was a multi post of different thread. since reading through other thread doesn't really answer my curiosity