Hi there,
I am new to Unity so pardon the ignorance. I have been looking around these forums for a possible solution but haven’t found one, hence the post.
I am basically moving a sprite and wish to destroy it once it has completed traversing the path. However I do not know how to access the object calling the callback. Here is the code:
void Start () {
Enemies.Add(Instantiate(EmptyPrefab,new Vector3(742f,82f,50f),Quaternion.identity));
Sprite s = enemySpriteManager.AddSprite((GameObject)Enemies[0],64f,64f,0,0,64,64,false);
iTween.MoveTo((GameObject)Enemies[0],iTween.Hash("path",iTweenPath.GetPath("Path1"),"time",7,"easetype",iTween.EaseType.easeInOutSine,"onComplete","EnemyComplete","onCompleteTarget",gameObject));
}
void EnemyComplete (){
Debug.Log("EnemyComplete");
DestroyObject(//????????);
}
Could someone please explain how this ought to be done.
Thanks a lot ![]()