Search Unity

unity 5 + playmaker webgl/webplayer/standalone issues

Discussion in 'Immediate Mode GUI (IMGUI)' started by cgidesign, Jul 10, 2015.

  1. cgidesign

    cgidesign

    Joined:
    Jul 10, 2015
    Posts:
    3
    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 (CSharp):
    1. using UnityEngine;
    2.  
    3. namespace HutongGames.PlayMaker.Actions
    4. {
    5.     [ActionCategory("iTween")]
    6.     [Tooltip("Changes a GameObject's opacity over time.")]
    7.     public class iTweenFadeTo: iTweenFsmAction
    8.     {
    9.         [RequiredField]
    10.         public FsmOwnerDefault gameObject;
    11.        
    12.         [Tooltip("iTween ID. If set you can use iTween Stop action to stop it by its id.")]
    13.         public FsmString id;
    14.        
    15.         [Tooltip("The initial alpha value of the animation.")]
    16.         public FsmFloat alpha;
    17.         [Tooltip("Whether or not to include children of this GameObject. True by default.")]
    18.         public FsmBool includeChildren;
    19.         [Tooltip("Which color of a shader to use. Uses '_Color' by default.")]
    20.         public FsmString namedValueColor;
    21.         [Tooltip("The time in seconds the animation will take to complete.")]
    22.         public FsmFloat time;
    23.         [Tooltip("The time in seconds the animation will wait before beginning.")]
    24.         public FsmFloat delay;
    25.         [Tooltip("The shape of the easing curve applied to the animation.")]
    26.         public iTween.EaseType easeType = iTween.EaseType.linear;
    27.         [Tooltip("The type of loop to apply once the animation has completed.")]
    28.         public iTween.LoopType loopType = iTween.LoopType.none;
    29.        
    30.         public override void Reset()
    31.         {
    32.             base.Reset();
    33.             id = new FsmString{UseVariable = true};
    34.             alpha = 0f;
    35.             includeChildren = true;
    36.             namedValueColor = "_Color";
    37.             time = 1f;
    38.             delay = 0f;
    39.         }
    40.        
    41.         public override void OnEnter()
    42.         {
    43.             base.OnEnteriTween(gameObject);
    44.             if(loopType != iTween.LoopType.none) base.IsLoop(true);
    45.             DoiTween();  
    46.         }
    47.        
    48.         public override void OnExit(){
    49.             base.OnExitiTween(gameObject);
    50.         }
    51.        
    52.         void DoiTween()
    53.         {
    54.             GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);
    55.             if (go == null) return;
    56.            
    57.             itweenType = "fade";
    58.             iTween.FadeTo(go, iTween.Hash(
    59.                 "name", id.IsNone ? "" : id.Value,
    60.                 "alpha", alpha.Value,
    61.                 "includechildren", includeChildren.IsNone ? true : includeChildren.Value,
    62.                 "NamedValueColor", namedValueColor.Value,
    63.                 "time", time.Value,
    64.                 "delay", delay.IsNone ? 0f : delay.Value,
    65.                 "easetype", easeType,
    66.                 "looptype", loopType,
    67.                 "oncomplete", "iTweenOnComplete",
    68.                 "oncompleteparams", itweenID,
    69.                 "onstart", "iTweenOnStart",
    70.                 "onstartparams", itweenID,
    71.                 "ignoretimescale", realTime.IsNone ? false : realTime.Value
    72.                 ));
    73.         }
    74.     }
    75. }

    I have a few more issues with playmaker and unity 5 but i want to go through them one by one.

    any help will be greatly appreciated!

    Thanks

    Ahmed
     
  2. cgidesign

    cgidesign

    Joined:
    Jul 10, 2015
    Posts:
    3