ArticyRef Class

Used to expose articy objects safely in your unity components.

Definition

Namespace: Articy.Unity
Assembly: ArticyRuntime (in ArticyRuntime.dll) Version: 1.3.0
C#
[SerializableAttribute]
public class ArticyRef : ISerializationCallbackReceiver
Inheritance
Object    ArticyRef
Implements
ISerializationCallbackReceiver

Remarks

Use this type to create custom fields in your scripts to hold weak references of articy objects and expose them to the unity inspector to allow the designers to easily modify them.

ArticyRef makes sure that the object is properly stored even when rebuilding the database without loosing the actual reference. This class even keeps the reference to the object if your import doesn't contain the referenced model anymore.

Example

C#
class MyScript : MonoBehaviour
{
    public ArticyRef offHandItem;

    void Start()
    {
        var item = offHandItem.GetObject<Entity>(); 
        // Entity is used for this example. If you use that example in your code, the type of the object depends on the Template.
    }
}

Constructors

Properties

HasReference Gets a value indicating whether this instance has an assigned reference.

Methods

GetObject Gets the referenced object.
GetObjectTObject Gets the the referenced object and tries to cast it into the given type

Operators

(ArticyObject to ArticyRef) Performs an explicit conversion from ArticyObject to ArticyRef.
(ArticyRef to ArticyObject) Performs an explicit conversion from ArticyRef to ArticyObject.

Fields

instanceId The instance id of the referenced object
referencingMode Describes how the ArticyRef will handle the underlying reference, especially when calling GetObject.

See Also