ICopyable<T>
where
TextendsMonoBehaviour
Description
Re-instantiating existing GameObjects is not always as easy as calling Instantiate(), especially
when the object has been created at runtime as is not a prefab of some sorts.
ICopyable tries to bridge this gap by enforcing explicit Copy() and CopyFrom() method
calls which can be used to create a new instance of a component.
The intention of this interface is provide access to deep copying of a component.
Copy()
tip
Most of the native elements in UCGUI implement this interface. If you are unsure how exactly an implemenation could look like, take a look at the Button's implemenation.
Examples
Simple UI Example
TextComponent myText = UI.Text("Foo");
// creates a deep copy, text, rect, etc. are all copied
TextComponent myText2 = myText.Copy();
Implementation
note