31
DOTween & DOTween Pro / Re: Adding a Tween to a sequence by its ID
« on: April 21, 2015, 11:14:54 AM »
FYI in case it helps anyone else I have got around this for now by using this:
this lets me construct sequences as follows:
and trigger it in the code just with:
It'd still be nice to know what's going on with TweensById not working, but I can at least proceed now. Thanks!
Code: [Select]
private Tween FindTween (string pUIObjectName,
string pTweenName)
{
Tween vReturnTween = null;
GameObject vUIObject = GameObject.Find (pUIObjectName).gameObject;
if (vUIObject != null)
{
List<Tween> vFindTweenList = DOTween.TweensByTarget (vUIObject);
if (vFindTweenList != null)
{
foreach (Tween vFindTween in vFindTweenList)
{
if (vFindTween != null &&
vFindTween.id.ToString () == pTweenName)
{
vReturnTween = vFindTween;
break;
}
}
}
}
return vReturnTween;
}
this lets me construct sequences as follows:
Code: [Select]
// Construct HUD in sequence
vHUDPanelsIn = DOTween.Sequence ();
vHUDPanelsIn.Insert (0.0f, FindTween ("HUDPanelTop", "HUDPanelTopIn"));
vHUDPanelsIn.Insert (0.0f, FindTween ("HUDPanelLeft", "HUDPanelLeftIn"));
vHUDPanelsIn.Insert (0.0f, FindTween ("HUDPanelRight", "HUDPanelRightIn"));
and trigger it in the code just with:
Code: [Select]
public void ShowHUD ()
{
// Restart and play the tweens
vHUDPanelsIn.Restart ();
}
It'd still be nice to know what's going on with TweensById not working, but I can at least proceed now. Thanks!