Hi
I have a Button which when clicked actives a tween of a panel. The button also create an object which is a "preview model"
in the panel. So the panel tweens all well but I have to destroy the model which the panel tweens back into its start position and this seems to be causing issues.
public void ShowPreviewPanel()
{
TweenPosition pTweenTest;
//Activates the preview panel. Also tweens the panel in and out
if(previewPanel.active == false)
{
NGUITools.SetActive(previewPanel, true);
pTweenTest = TweenPosition.Begin(previewPanel, 1f, new Vector3(-332,378,0));
}
else
{
pTweenTest = TweenPosition.Begin(previewPanel, 1f, new Vector3(-332,-200,0));
EventDelegate.Add(pTweenTest.onFinished, OnFinishedPreview);
}
}
void OnFinishedPreview()
{
//Function call at the end of the tween to deactivate the panel and delete the preview object
NGUITools.SetActive(previewPanel, false);
Debug.Log ("Test");
//NGUITools.Destroy(previewObject);
}
So I think I want the Event being added to not be at end of the tween but actually at the beginning, so the model gets deleted and the tween happens but I am unsure of how to do this. I hope you can help, thank you