AnimancerEvent.Sequence.Serializable.

AnimancerEvent.Sequence.

AnimancerEvent.

Clone(CloneContext) Method

Summary

Creates a new object with the same type and values this.
Assembly
Animancer.dll
Namespace
Animancer
Containing Type
AnimancerEvent.Sequence.Serializable

Syntax

public AnimancerEvent.Sequence.Serializable Clone(CloneContext context)

Remarks

Calling this method directly is not generally recommended. Use Animancer.CloneableExtensions.Clone``1(Animancer.ICloneable{``0}) if you don't have a `context` or Animancer.CloneContext.GetOrCreateClone``1(Animancer.ICloneable{``0}) if you do have one.

Example:
class BaseClass : ICloneable
{
    // Explicit implementation so that the recommended methods will be used instead.
    object ICloneable.Clone(CloneContext context)
    {
        var clone = (BaseClass)MemberwiseClone();
        clone.CopyFrom(this, context);
        return clone;
    }
    
    // Protected method which should only be called by Clone.
    protected virtual void InitializeClone(CloneContext context)
    {
        // Alter any necessary BaseClass fields according to the context.
    }
}

class DerivedClass : BaseClass
{
    protected override void InitializeClone(CloneContext context)
    {
        base.CopyFrom(copyFrom, context);
        
        var derived = (DerivedClass)copyFrom;
        // Alter any necessary DerivedClass fields according to the context.
    }
}

Parameters

Name Type Description
context CloneContext

Return Value