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 - Schwarzenego

Pages: [1]
1
DOTween & DOTween Pro / Re: DOTween and for's
« on: November 09, 2015, 01:31:53 AM »
Hey,

Don't worry about the delay, I delayed in answering myself =P

Thanks for the hint! Right now Im going with the "method call" solution as it was working for me and since there isnt much difference performance wise from declaring new variable to calling a method I will leave it at that, too much work for too little haha, but anyway, thanks for the help!

I editted the post's title so it is more informative to people in the future, it was previously "DOTween and NGUI" but that is not the issue right?

Anyway, thanks for the support and for the great, awesome plugin!

2
DOTween & DOTween Pro / Re: DOTween and NGUI
« on: October 16, 2015, 04:06:21 AM »
Alright, promise, last update =P:

This works (not sure if surprisingly or unsurprisingly):
Code: [Select]
protected virtual void OnClick()
{
for (int i = 0; i < _childWidget.Length; i++)
Animate (i);
}

private void Animate(int i)
{
DOTween.To(() => _childWidget[i].color, x => _childWidget[i].color = x, Color.gray, 1).SetAs(_tweenParams);
}

So yeah... "for"s are evil -.-

3
DOTween & DOTween Pro / Re: DOTween and NGUI
« on: October 16, 2015, 02:10:39 AM »
Update 3:

This works:
Code: [Select]
DOTween.To(() => _childWidget[0].color, x => _childWidget[0].color = x, Color.gray, 1).SetAs(_tweenParams);
DOTween.To(() => _childWidget[1].color, x => _childWidget[1].color = x, Color.gray, 1).SetAs(_tweenParams);
DOTween.To(() => _childWidget[2].color, x => _childWidget[2].color = x, Color.gray, 1).SetAs(_tweenParams);

This doesnt:
Code: [Select]
for (int i = 0; i < _childWidget.Length; i++)
DOTween.To(() => _childWidget[i].color, x => _childWidget[i].color = x, Color.gray, 1).SetAs(_tweenParams);

I don't even understand how that could possibly be even a bug... hahah how is it possible that just because its inside a loop it doesnt work? =(
Anyways, I think enough of my spam now, but please, if anyone has a clue, let me know!

4
DOTween & DOTween Pro / Re: DOTween and NGUI
« on: October 16, 2015, 12:25:44 AM »
Update 2:

So, apparently calling this works:
Code: [Select]
_tweenColor [0] = DOTween.To (() => _childWidgets [0].color, x => _childWidgets [0].color = x, _disabledColor [0], _currentAnimationDuration).SetAs(_tweenParams);
But calling this doesn't work:
Code: [Select]
for (byte i = 0; i < _tweenColor.Length; i++)
_tweenColor [i] = DOTween.To (() => _childWidgets [i].color, x => _childWidgets [i].color = x,_disabledColor [i], _currentAnimationDuration).SetAs(_tweenParams);

That is testing in the same object, same script, same place, same everything... which means _tweenColor and all others count is greater than one, and the code is being called... so it leads me to believe that the "for" is whats causing this trouble... which makes no sense to me =P.

5
DOTween & DOTween Pro / Re: DOTween and NGUI
« on: October 15, 2015, 11:40:25 PM »
Update: I removed the "Kill" calls in the same frame... I forced a "Play" call right after "DOTween.To"... no effect =(, whats strange is that at times I have multiple tweens running at the same time, for example, the color, scale and a highlight sprite tweening alpha, and they all work except for the color tween... considering the code is very much the same except for it being a color... I don't understand how that can not be working, when in the example I posted a few minutes ago it does work =(.

6
DOTween & DOTween Pro / Re: DOTween and NGUI
« on: October 15, 2015, 10:17:52 PM »
Ok apparently I was being really dumb at some point. I entered the preferences panel and turned on "AutoPlay" and it worked -.-. Sorry for the extra bother there! However, even now, on my previous code it doesn't work, even though I have basically the same setup only in a much more complex class. Only thing I can imagine is the "Kill" command happening in the same frame as the "Dotween.To" might be causing some kind of problem... is that even possible?

Thanks!

7
DOTween & DOTween Pro / Re: DOTween and NGUI
« on: October 15, 2015, 09:33:03 PM »
So, I've decided to make a smarter test =P

I put the following code into a pseudo button:
Code: [Select]
using UnityEngine;
using System.Collections;
using DG.Tweening;

public class UIButtonTest : MonoBehaviour
{
private UISprite _childWidget;
private Tweener _tweenColor;
private TweenParams _tweenParams;

private void Start ()
{
_childWidget = GetComponent<UISprite> ();
_tweenParams = new TweenParams ();
_tweenParams.SetEase (Ease.InOutSine).SetUpdate (true);
}

protected virtual void OnClick()
{
Debug.Log ("onClick TweenColor");
_tweenColor = DOTween.To(() => _childWidget.color, x => _childWidget.color = x, Color.gray, 1).SetAs(_tweenParams);
_tweenColor.OnUpdate(()=> Debug.Log(_childWidget.color));
}
}

When clicked, output is only "onClick TweenColor" =(. Any ideas why?

8
DOTween & DOTween Pro / Re: DOTween and NGUI
« on: October 15, 2015, 09:25:50 PM »
Hey Daniele, thanks for the quick reply!

I've made the following test:
Code: [Select]
Debug.Log ("onClick TweenColor");
_tweenColor[i] = DOTween.To(() => _childWidgets[i].color, x => _childWidgets[i].color = x, _pressedColor [i], 1).SetAs(_callbackRegistered ? _tweenParams : _tweenParamsCallback);
_tweenColor[i].OnUpdate(()=> Debug.Log(_childWidgets[i].color));

It does output "onClick TweenColor", but nothing else =(. For some reason it seems that OnUpdate is not getting called...

Let me go into more detail in this class of mine. I create the "tweenparams" on Start, and use it repeatedly on multiple, tons of tweens depending on each button configuration. These tweens are triggered by button events such as clicks, and everytime they are triggered, I run a method that basically looks at all running tweeners and kill them. So basically in the same frame I have a call to Kill (if it exists), and later in the same frame I run DOTween.To()... is that a problem?

Anyway, any more ideas of what could be causing it? =(

Anyway, thanks for the attention!

9
DOTween & DOTween Pro / DOTween and for's
« on: October 15, 2015, 08:03:13 PM »
Hey,

I've looked around but couldn't find anyone with this issue so maybe I am doing something wrong. My game uses NGUI for practically everything UI-wise, and I was until recently using HOTween to animate my buttons colors and multiple properties really. It was working nicely but I decided to upgrade to DOTween as its better, accordingly to you =P.

However, apparently it is not being able to tween the color of NGUI Widgets for some reason. Here is the call I am using:
_tweenColor = DOTween.To(() => _childWidgets.color, x => _childWidgets.color = x, _pressedColor , _currentAnimationDuration).SetAs(_tweenParams);

And the _tweenParams in this occasion:
_tweenParams.SetEase (Ease.InOutSine).SetUpdate(true);

In short, its just not working =/ Meanwhile, this other call is working as expected:
_tweenHighlight = DOTween.To(() => HighlightSprite.alpha, x => HighlightSprite.alpha = x, 1f, _currentAnimationDuration).SetAs(_tweenParams);

So... any idea on what might be causing this issue? The color doesn't get tweened at all, not even changed =/.

PS: I already checked, the code is being called.

Thanks in advance,
Allan

Pages: [1]