LWFObject.AttachLWF C# (CSharp) Method

AttachLWF() public method

public AttachLWF ( string instanceName, LWFObject, lwfObject, string attachName, int attachDepth = -1, bool reorder = false, System.Action attachHandler = null, Func,System detachHandler = null ) : void
instanceName string
lwfObject LWFObject,
attachName string
attachDepth int
reorder bool
attachHandler System.Action
detachHandler Func,System
return void
    public void AttachLWF(string instanceName, LWFObject lwfObject,
		string attachName, int attachDepth = -1, bool reorder = false,
		LWFObjectAttachHandler attachHandler = null,
		LWFObjectDetachHandler detachHandler = null)
    {
        AddLoadCallback((o) => {
            lwfObject.AddLoadCallback((lo) => {
                AddMovieLoadHandler(instanceName, (m) => {
                    m.AttachLWF(lwfObject.lwf,
                            attachName, attachDepth, reorder, (attachedLWF) => {
                        if (detachHandler == null) {
                            if (lwfObject.isAlive)
                                Destroy(lwfObject.gameObject);
                        } else {
                            if (detachHandler(lwfObject) && lwfObject.isAlive)
                                Destroy(lwfObject.gameObject);
                        }
                    });
                    if (attachHandler != null)
                        attachHandler(lwfObject);
                });

                lwfObject.callUpdate = false;

                Transform transform = lwfObject.gameObject.transform;
                transform.parent = gameObject.transform;
                transform.localPosition = Vector3.zero;
                transform.localRotation = Quaternion.identity;
                transform.localScale = Vector3.one;
            });
        });
    }