Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - cynicalwanderer

Pages: 1 2 [3]
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:

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!

32
DOTween & DOTween Pro / Re: Adding a Tween to a sequence by its ID
« on: April 21, 2015, 09:00:55 AM »
Yes, AutoPlay is off and the sequence is being constructed well after Awake, so it's not that.

I've checked a few of your other list commands such as TweensByTarget (off the GameObject holding them) and PausedTweens and those seem to bring up their tweens list just fine, so they are definitely there and don't appear to have started yet.  It's only TweensById that doesn't seem to be working and unfortunately that's the one I need to be able to identify them via string.  Could that function be not picking up the visual editor ones perhaps?

I also tried as an alternative option having public inspector Tween or Tweener variables in the code and then dragging the tween directly onto the variable in inspector to access it that way, which is a trick I've used before in another product, but that didn't work either.  Is it possible for these types to be exposed in the inspector as well when public, to further allow for any visual editor tweens to be attached and then identified in the code?

Visual sequences would be very nice.   :)  As would having a "tween" for setting UI objects to enabled/disabled or visible/invisible to include in those sequences.  For example some of my sequences involve a rotation where at the peak of the rotate, one sprite swaps out and another swaps in.  It would be great if I could work the timing of those bool changes into the tween sequence chain and have it all handled there.

33
DOTween & DOTween Pro / Adding a Tween to a sequence by its ID
« on: April 21, 2015, 02:16:24 AM »
Hi,

I've got some DOTween Pro component tweens added on some uGUI panels that I have given ID names to in the inspector, and I'm wanting to collect these tweens up in a sequence so I can fire them all off via code.

This works:
Code: [Select]
DOTween.Restart ("HUDPanelTopIn");
DOTween.Restart ("HUDPanelLeftIn");
DOTween.Restart ("HUDPanelRightIn");

However I'm not sure how to insert into the sequence using those ID strings.  E.g. after looking at the doco I tried writing a little function that polls :

Code: [Select]
vHUDPanelsIn = DOTween.Sequence ();
vHUDPanelsIn.Insert (0.0f, FindTween ("HUDPanelTopIn"));
vHUDPanelsIn.Insert (0.0f, FindTween ("HUDPanelLeftIn"));
vHUDPanelsIn.Insert (0.0f, FindTween ("HUDPanelRightIn"));

...

private Tween FindTween (string pTweenName)
{
Tween vReturnTween = null;

List<Tween> vFindTweenList = DOTween.TweensById (pTweenName);
if (vFindTweenList != null)
{
foreach (Tween vFindTween in vFindTweenList)
{
if (vFindTween != null)
{
vReturnTween = vFindTween;
break;
}
}
}

return vReturnTween;
}

which I had hoped would do it, however the "DOTween.TweensById" seems to be returning a null list.

Am I doing something wrong?  Is there an easier way to get the tween object by ID for use in a sequence?


Pages: 1 2 [3]