playMaker

Author Topic: unity 5 + playmaker fade  (Read 2738 times)

cgidesign

  • Playmaker Newbie
  • *
  • Posts: 5
unity 5 + playmaker fade
« 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.

Code: [Select]
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

cgidesign

  • Playmaker Newbie
  • *
  • Posts: 5
Re: unity 5 + playmaker fade
« Reply #1 on: July 10, 2015, 11:03:14 AM »
bump 

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: unity 5 + playmaker fade
« Reply #2 on: July 10, 2015, 11:42:45 AM »
Hi,

Maybe check out HOTween or DOTween (HOTween V2)

you can find HOTween action package here

and DOTween here

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.

cgidesign

  • Playmaker Newbie
  • *
  • Posts: 5
Re: unity 5 + playmaker fade
« Reply #3 on: July 13, 2015, 07:23:54 AM »
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