Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: cgidesign on July 10, 2015, 06:35:50 AM
-
Hi guys
wondering if someone can point me in the right direction...
im trying to fade an object by using is alpha. ive tried using a custom script i found on the forum called iTween fade to. It works in unity but not when i build it.
I'll attach it just in case if you dont know what im talking about.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("iTween")]
[Tooltip("Changes a GameObject's opacity over time.")]
public class iTweenFadeTo: iTweenFsmAction
{
[RequiredField]
public FsmOwnerDefault gameObject;
[Tooltip("iTween ID. If set you can use iTween Stop action to stop it by its id.")]
public FsmString id;
[Tooltip("The initial alpha value of the animation.")]
public FsmFloat alpha;
[Tooltip("Whether or not to include children of this GameObject. True by default.")]
public FsmBool includeChildren;
[Tooltip("Which color of a shader to use. Uses '_Color' by default.")]
public FsmString namedValueColor;
[Tooltip("The time in seconds the animation will take to complete.")]
public FsmFloat time;
[Tooltip("The time in seconds the animation will wait before beginning.")]
public FsmFloat delay;
[Tooltip("The shape of the easing curve applied to the animation.")]
public iTween.EaseType easeType = iTween.EaseType.linear;
[Tooltip("The type of loop to apply once the animation has completed.")]
public iTween.LoopType loopType = iTween.LoopType.none;
public override void Reset()
{
base.Reset();
id = new FsmString{UseVariable = true};
alpha = 0f;
includeChildren = true;
namedValueColor = "_Color";
time = 1f;
delay = 0f;
}
public override void OnEnter()
{
base.OnEnteriTween(gameObject);
if(loopType != iTween.LoopType.none) base.IsLoop(true);
DoiTween();
}
public override void OnExit(){
base.OnExitiTween(gameObject);
}
void DoiTween()
{
GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go == null) return;
itweenType = "fade";
iTween.FadeTo(go, iTween.Hash(
"name", id.IsNone ? "" : id.Value,
"alpha", alpha.Value,
"includechildren", includeChildren.IsNone ? true : includeChildren.Value,
"NamedValueColor", namedValueColor.Value,
"time", time.Value,
"delay", delay.IsNone ? 0f : delay.Value,
"easetype", easeType,
"looptype", loopType,
"oncomplete", "iTweenOnComplete",
"oncompleteparams", itweenID,
"onstart", "iTweenOnStart",
"onstartparams", itweenID,
"ignoretimescale", realTime.IsNone ? false : realTime.Value
));
}
}
}
Thanks
Ahmed
-
bump
-
Hi,
Maybe check out HOTween (https://www.assetstore.unity3d.com/en/#!/content/3311) or DOTween (https://www.assetstore.unity3d.com/en/#!/content/27676) (HOTween V2)
you can find HOTween action package here (http://hutonggames.com/playmakerforum/index.php?topic=2299.0)
and DOTween here (http://hutonggames.com/playmakerforum/index.php?topic=10303.0)
i know HOTween has a float tween but HOTween has no support anymore,
i have not used DOTween yet but i think it also has that.
-
hey
Great thanks for the info djaydino, ill be sure to check it out and post how i get on with it. hopefully this solves the million issues im having atm.
cheers
Ahmed