Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

LeanTouch+ ☀️ LeanPool ☀️ LeanGUI ☀️ LeanLocalization ☀️ LeanTransition

Discussion in 'Assets and Asset Store' started by Darkcoder, Aug 1, 2019.

  1. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,873
    when I do this
    upload_2021-2-6_19-35-49.png
    I'm expecting the 2 last transitions to start at the same time after the 0.5 joindelay, meaning that bubble group is activated at the start of the bubble group scale transition
    instead what I get is activation when scale is done.
    So there is maybe something I'm not understanding about the way joindelay work, how do I get the expected result? should i move the joindelay elsewhere?
     
  2. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,873
    How do you pass parameters by code? The idea is that one script sets the variable text and another event triggers the typewriter transition.
    upload_2021-2-7_4-26-8.png
    the example above doesn't set the text in this custom transition:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3. using System.Collections.Generic;
    4.  
    5. namespace Lean.Transition.Method
    6. {
    7.     /// <summary>This component typewriters an existing text.</summary>
    8.     [HelpURL(LeanTransition.HelpUrlPrefix + "LeanTextTypewriter")]
    9.     [AddComponentMenu(LeanTransition.MethodsMenuPrefix + "Text/Text.typewriter" + LeanTransition.MethodsMenuSuffix + "(LeanTextTypewriter)")]
    10.     public class LeanTextTypewriter : LeanMethodWithStateAndTarget
    11.     {
    12.         public override System.Type GetTargetType()
    13.         {
    14.             return typeof(Text);
    15.         }
    16.  
    17.         public override void Register()
    18.         {
    19.             PreviousState = Register(GetAliasedTarget(Data.Target), Data.Duration, "--must be set--", Data.Ease);
    20.         }
    21.  
    22.         public static LeanState Register(Text target, float duration, string text, LeanEase ease = LeanEase.Linear)
    23.         {
    24.             var state = LeanTransition.SpawnWithTarget(State.Pool, target);
    25.             state.Ease = ease;
    26.             state.text = text;
    27.             return LeanTransition.Register(state, duration);
    28.         }
    29.  
    30.         [System.Serializable]
    31.         public class State : LeanStateWithTarget<Text>
    32.         {
    33.             [Tooltip("The ease method that will be used for the typewriting rate.")]
    34.             public LeanEase Ease = LeanEase.Smooth;
    35.             [System.NonSerialized] string _currentString;//,_oldString ;
    36.             [System.NonSerialized] int _charCount;
    37.             const string TRANSPARENTRICHTEXT = "<color=#00000000>";
    38.             const string CLOSECOLORRICHTEXT = "</color>";
    39.             public override int CanFill => Target != null ? 1 : 0;
    40.             public string text;
    41.  
    42.             public override void BeginWithTarget()
    43.             {
    44.                 // _oldString = Target.text;
    45.                 _charCount = text.Length;
    46.             }
    47.  
    48.             public override void UpdateWithTarget(float progress)
    49.             {
    50.                 if (progress != 1)
    51.                 {
    52.                     int currentWordInsertIndex = (int) (Smooth(Ease, progress) * _charCount);
    53.                     _currentString = text.Insert(currentWordInsertIndex, TRANSPARENTRICHTEXT) + CLOSECOLORRICHTEXT;
    54.                     Target.text = _currentString;
    55.                 }
    56.                 else
    57.                 {
    58.                     Target.text = text;
    59.                 }
    60.             }
    61.  
    62.             public static Stack<State> Pool = new Stack<State>();
    63.  
    64.             public override void Despawn()
    65.             {
    66.                 Pool.Push(this);
    67.             }
    68.         }
    69.         public State Data;
    70.     }
    71. }
    72.  
    73. namespace Lean.Transition
    74. {
    75.     public static partial class LeanExtensions
    76.     {
    77.         public static Text typewriterTransition(this Text target, float duration, string text,LeanEase ease = LeanEase.Linear)
    78.         {
    79.             Method.LeanTextTypewriter.Register(target, duration, text, ease);
    80.             return target;
    81.         }
    82.     }
    83. }
    where the typewriter transition is activated by calling BeginTransition in LeanAnimation
    upload_2021-2-7_4-29-28.png
     
  3. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    53
    Yes Sure.

    So no matter if I put 600 or 6000 in either of the two, it's always moving/rotating with the same speed.

    Screen Shot 2021-02-08 at 16.15.34.png

    Yeah, I'm more so talking about a maximum finger count. But I when putting 1 to Required Finger Count this already works... On iPhone X+ there is an issue with the bottom-right corner that makes the app move, but I guess this is a system thing and has nothing to do with this.

    So for example for that above component Lean Multi Update with Manual Torque, it would be nice to have native Playmaker actions for the multiplier, or for example what is hidden is the drag velocity. If we had a "Get drag speed" I could do things based on if the user swipes left or right (negative or positive drag speed).

    Basically what you can access by code, would be awesome to be able to access through playmaker as well. Does that make sense?
     
  4. starfoxy

    starfoxy

    Joined:
    Apr 24, 2016
    Posts:
    117
    I absolutely LOVE the lean series and especially lean pool.

    I am having an issue however.

    My prefab spawns fine multiple times when I press a button.

    On my spawned prefab I have a script in Start() as such:

    LeanPool.Despawn(gameObject, timetoexpiry);

    This is the only thing I have in my script. Really simple.

    Normally, Destroy has a wait timer as the second parameter. What I am finding is that the objects will despawn intermittently based on the timer float value. Really weird. Sometimes they despawn properly and other times not.

    Any ideas?

    **update**

    I even tried it with a coroutine as a timer to despawn (rather than the built in delay). The same intermittent behavior still happens. Super super weird. Any ideas anyone?
     
    Last edited: Feb 9, 2021
  5. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    When you insert a Join transition, it only joins one previous and one next transition. For example: A JOIN B, C, therefore A and C will execute at the same time. To fix this you can A JOIN B JOIN C, which will work because in your scenario B has a duration of 0. If B had a duration then you can place these other transitiosn on a child GameObject (see "04 Branches" demo scene), or you can use the Queue Transition component (LeanQueue), and point it to A, like this: A JOIN B QUEUE(A) C. Join is the same as Queue(previous), but it allows you to explicitly pick the transition that must finish first.

    If you want to modify 'text' before the transition is started then you can access it from your component's Data field, which is declared near the bottom.

    1 - The code for these looks fine. You may be hitting your Rigidbody's maxAngularVelocity setting, you can increase this from code only I believe.

    3 - Makes sense, but I don't see why you can't already do this. The Multiplier value for example is just a standard public field, does PlayMaker not have the ability to read or write these? If it only has the ability to call functions then I can make this a property, then you should be able to call it. For detecting drag direction you should be able to use the OnDelta event for example, and check it. The problem with PlayMaker actions is that adding them for everything would be thousands of actions, and actions like detecting drag left/right/etc would require custom code and thus a ton of time.

    Can you describe a really simple scenario that would replicate this issue?

    Also, keep in mind Start will only get called once during a component's lifetime. If this code is something you want to have run each time it gets spawned then you should use OnEnable, or use one of the pooling events in the examples.
     
  6. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,873
    Thank you! I traced for a while, Register gets called when the transition is called (I assumed wrongly that it was like an Awake called one in the game object's lifetime). It needed to pass Data.text and now all works.
    upload_2021-2-9_9-5-21.png
    I don't understand this way of programming at all where calls are bounce all over the place and it's the way Unity programs things nowadays. Does that pattern have a name so I can google on it?

    Oh I see! I thought that B and C were going to autoqueue after the Join.
    How does lean understand this following chain (not working either)?
    upload_2021-2-9_9-23-20.png
    I find myself sequencing like this a lot so does leantween have an AutoJoin?
     
    Last edited: Feb 9, 2021
  7. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    I'm not sure what you mean by bounce things around. The code is designed like this because it needs to work the same via the inspector (in-editor), and via code in C#. Inspector requires a component, so that's why it's on the outside, and inside this is the normal class that actually handles the transition. The extension method(s) at the bottom just make it so you can easily create the transitions from code without knowing the name of the transition component and internal class.

    I have no plans to add any kind of auto join system, because it would be too easy to break everything if you forget to specify when your joins should stop. It would be possible for the in-editor stuff to automatically stop joining at the last transition on the GameObject, but this isn't possible from code, and I don't want them to work differently.
     
  8. starfoxy

    starfoxy

    Joined:
    Apr 24, 2016
    Posts:
    117
    Hey awesome, thanks! OnEnable() seemed to get it sorted. Just for my own learning, why wouldn't Start() work the same as I only need to run it once anyhow?
     
  9. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    53
    There is a way to access everything that is public, nothing private can be accessed. But also the public ones are using reflection so this is not ideal. A native action would resolve this issue completely and be much more performant.

    But yes, I get your point of it being tons of code to write and Playmaker users are probably in the minority. So anyways, it's amazing to have your great asset even without those.

    Also, I just googled that maxAngularVelocity thing, thanks for the tip.
     
  10. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    205
    I'm using QuickDrag on an Image where I'm using it on a Canvas Scaler with Match Screen Width or Height with Height=1.

    But the drag offset does not work as expected! It has a wrong offset when moving. It will only work if the Current Game Resolution is the same as the Canvas Scale relative resolution.

    What am I doing wrong?
     
  11. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,873
    Fair.
    I sprinkled Joins everywhere, why is this not working but if the first component duration is 0.001 it works.
    upload_2021-2-9_20-41-35.png
     
  12. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Start is only run once for the component, but OnEnable is run every time the component is enabled. Since the whole point of pooling is to reuse GameObjects and thus their components, so you want to have the same code run each time you spawn the object, not just on the first spawn.


    What is QuickDrag?

    Are you using the latest version (1.1.4)? The previous versions had this issue.
     
  13. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,873
    Just updated, still broken on duration of 0. It's ok I'll increase it to 0.01. Thanks.
     
  14. starfoxy

    starfoxy

    Joined:
    Apr 24, 2016
    Posts:
    117
    Ok I know I am going to feel totally silly here but I have an error that popped up.

    Everything was working great and then I decided to create a layer that my spawned prefab will live on. So I changed my prefab to use the new layer.

    When I went to run it again, it gave me:

    You're attempting to despawn a gameObject that wasn't spawned from this pool.

    Huh.

    Is this because I changed the layer (from default) on the prefab that I was spawning before? How can I learn more about this error?

    **edit**

    ok so it does appear to work with a layer change or not when I use my coroutine to despawn in OnEnable. It throws that error if I don't use my coroutine and instead use:

    LeanPool.Despawn(gameObject, timetoexpiry);

    Thanks again for any help you can provide.
     
  15. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Hmm, I can't see any issue on my end.

    If I make a new project with the latest version and modify the "03 Join" demo scene to be like this:

    upload_2021-2-11_11-41-11.png

    Then it works as expected, where it instantly snaps to a scale of 1,9,1, and then smoothly goes back to 4,4,4. Does this work for you too?

    The layer should have no impact on the way pooling works. It's hard to say what the issue is without a simple test case I can run myself.
     
  16. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,873
    Is there a way to access transitions in LeanAnimation? from script.
    what I am trying to do is this:
    one gameobject containing one LeanAnimation component
    a script sets its transitions field dynamically
    one event calls BeginTransition on LeanAnimation

    I see that if I drop any gameobject in LeanAnimation.transitions in the inspector it's fine but if I make transitions public then do a leanAnimation.transitions=someGameObject it's not working
    transition is of type LeanPlayer which doesn't inherit from UnityObject so I don't know how to do that, can you help?

    I've tried and it works but it seems a bit hacky
    upload_2021-2-12_11-56-27.png
     
    Last edited: Feb 12, 2021
  17. restush96

    restush96

    Joined:
    May 28, 2019
    Posts:
    28
    I'm trying to move a camera like first person camera using Pitch Yaw.
    But, I have a canvas that set order in layer -9999 which blocked the lean raycast.
    Is there a way to ignore canvas rather than disable it?

    Thanks!
     
  18. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    You can add a GameObject with: show.Transitions.Entries.Add(yourNewEntry);

    You can change your canvas layer and change the LeanTouch component's GuiLayers setting to ignore it.
     
    laurentlavigne and restush96 like this.
  19. LeventP

    LeventP

    Joined:
    Jul 17, 2020
    Posts:
    17
    LeanLocalization: Is there a way to find which localization strings are not being used? My localization file is reaching about 2K lines, and that'll cost me quite a bit when I need them to be translated into 18 different languages.

    About 10% of the lines are from older, removed designs from my game. If I could identify which are the ones unused, it would help a lot. Does Lean support such a feature?

    Second question: Some lines are duplicates. Removing those is easy, but it'll break the references in the Unity components. Is there a way to scan through the references and identify the duplicates for easy removal of those?
     
  20. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    1 - There's no built in way to do this, unless you look at the LeanLocalization inspector and open up every single translation and see which ones have missing entries. Your best bet is to write a custom script to do this.

    2 - Not without a custom script. I didn't include anything like this because modifying project wide scene data like this is risky, and the way Unity likes to keep changing their scene + prefab implementation, API, and serialization makes it pretty scary.
     
  21. KIZILKAYA

    KIZILKAYA

    Joined:
    Jun 22, 2015
    Posts:
    2
    Hi,
    I want to rotate a 2D object constrained between 2 angles. Is this possible? For example I want to rotate between 0 and 45 degrees on the z axis with 2 fingers.

    Also, when I want to rotate different 2d objects, they all rotate together. I want to be able to select and rotate them separately. How can I do it?

    Thank you.

    (LeanTouch+)
     
  22. Bentoon

    Bentoon

    Joined:
    Apr 26, 2013
    Posts:
    87
    Hi,
    Fast question in Lean Touch +
    If I publish to the Web, and need to use a keyboard
    - I can Rotate w left Mouse
    - Zoom w control
    - I normally Track with a 3 fingered touch using the Lean Drag Camera

    How can I Track with another key modifier (the alt / option or command) ?
    I've even tried to the simulate multi fingers in the Multi Drag Key in the Lean Touch

    There is probably a super simple way to accomplish
    Thanks !
    Screen Shot 2021-02-15 at 11.04.51 PM.png Screen Shot 2021-02-15 at 11.26.34 PM.png
    Thanks! @Darkcoder, I love the LT+ asset
    ~ be
     
  23. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    1 - You can use the LeanRoll component with the Clamp setting to do this. You can then call its IncrementAngle method from an event like LeanMultiTwist's OnTwistDegrees. This is shown in the "Lean/Touch+/Examples/05 Multi Twist" demo scene.

    2 - You must use the selection system for this. See the "Lean/Touch/Examples/21 Select 2D" and other scenes for how this can be set up.


    There's currently no way to do this. The only built in feature like this is the RequiredMouseButton option, which can be set to left/right/middle/etc clicks.

    This asset is designed for touch inputs and handling their equivalents with the mouse, and since key binds aren't part of this, there is no such functionality. I plan to experiment with keyboard and other controls this year, but I'm currently very busy.
     
    KIZILKAYA likes this.
  24. Bentoon

    Bentoon

    Joined:
    Apr 26, 2013
    Posts:
    87
    Darkcoder likes this.
  25. Fabrizio_Objvision

    Fabrizio_Objvision

    Joined:
    Feb 13, 2021
    Posts:
    2
    Hi
    Very good plugin, i love it.
    Can you help me with my problem?
    I am using the function LeanGesture.GetPinchRatio to get the zoom amount. It work well with mouseWheel and touch screens but if i use the laptop trackpad , the return value is different by 1 for the next few moments after touch up, this result in a full zoom with little movement.
    Is there any workaround or tips that you can suggest me?
    Thank you in advance.
     
  26. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    It sounds like your trackpad might be applying some kind of smoothing, which causes the scrolling to break due to it updating every frame. Can you try making a simple script that just outputs UnityEngine.Input.mouseScrollDelta.y and see what kind of values it gives?
     
  27. IJsLauw

    IJsLauw

    Joined:
    May 31, 2015
    Posts:
    9
    Hi @Darkcoder

    I noticed recently the maxSelectables behaviour changed, from this:

    // Deselect some if we have too many
    if (MaxSelectables > 0)
    {
    LeanSelectable.Cull(MaxSelectables - 1);
    }

    to this:

    // Skip if too many are selected?
    if (MaxSelectables > 0 && LeanSelectable.IsSelectedCount >= MaxSelectables)
    {
    return;
    // LeanSelectable.Cull(MaxSelectables - 1);
    }

    Why did you change this, and is there another (perhaps prefered) way of achieving the same result? (selecting the last clicked object and deselecting the previous selected object)
     
    Last edited: Feb 22, 2021
  28. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    275
    I'm trying to solve a long-standing issue and I'm not making any progress. I have a rhythm game that swipes left and right continuously, and occasionally swipes up for powerups. I can't find a way to register the swipe up because it's far beyond any tap or swipe thresholds and the finger never actually leaves the screen.
     
  29. Fabrizio_Objvision

    Fabrizio_Objvision

    Joined:
    Feb 13, 2021
    Posts:
    2
    Hi,
    Tanks for fast response.
    The behaviour of mouseScrollDelta.y is the same, it return values more often and also a few moments after touch up.
    Do you have any tips about this?
    PS: i've tested with macbook touchpad and with a asus rog laptop
    Thank you so much.
     
  30. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    The previous behaviour made it so that if you have selected the max amount and then select another, it would deselect the last and then select the new one. I changed it to just do nothing if you've reached the max, because I think that makes more sense. You can always change it back.


    The LeanFingerSwipe gesture requires the finger to stop touching the screen for it to fire. It sounds like you want the LeanFingerFlick from LeanTouch+? This will fire as soon as the distance and angle requirements are met.


    Can you show me the kind of values you get? From my mouse they are either +1 or -1 for each click. When you release, do the values gradually reduce to 0?
     
    JohnnyFactor likes this.
  31. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,873
    man, this is a sleek way to queue up transitions!
    upload_2021-2-23_18-45-41.png
     
    Darkcoder likes this.
  32. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,873
    Is there a way to see which transitions are in the queue? Sort of a debug tool.
     
  33. restush96

    restush96

    Joined:
    May 28, 2019
    Posts:
    28
    Alternatively `OnMouseEnter` & `OnMouseExit` using Lean Touch/Touch+?
     
  34. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,873
    -hide health isn't working in this hiearchy, why is that?
    the lean animation at the bottom of "-init health"
    upload_2021-2-27_12-18-55.png
    references "-hide health"
    upload_2021-2-27_12-19-8.png
     
  35. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,873
    how do you stop a repeating transition? is there a lean module for that?
    here is the setup:
    this repeats
    upload_2021-2-27_13-4-19.png
    this needs to interupt the repeat
    upload_2021-2-27_13-4-33.png
     
  36. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,873
    is there a more elegant way to get Lean Animation Repeater delta time to be controlled by LeanTransition LeanTiming Update than this?
    Code (CSharp):
    1. using UnityEngine;
    2. using FSA = UnityEngine.Serialization.FormerlySerializedAsAttribute;
    3.  
    4. namespace Lean.Transition.Extras
    5. {
    6.     /// <summary>This component executes the specified transitions at regular intervals.</summary>
    7.     [HelpURL(LeanTransition.HelpUrlPrefix + "LeanAnimationRepeater")]
    8.     [AddComponentMenu(LeanTransition.ComponentMenuPrefix + "Lean Animation Repeater")]
    9.     public class LeanAnimationRepeater : LeanAnimationOnce
    10.     {
    11.         /// <summary>The time in seconds between each animation.</summary>
    12.         public float TimeInterval { set { timeInterval = value; } get { return timeInterval; } } [SerializeField] [FSA("TimeInterval")] float timeInterval = 3.0f;
    13.         public LeanTiming update;
    14.      
    15.         protected override void Start()
    16.         {
    17.             if (remainingTime <= 0.0f)
    18.             {
    19.                 BeginTransitionsAndEvent();
    20.             }
    21.         }
    22.  
    23.         float DeltaTime(LeanTiming timing)
    24.         {
    25.             switch (timing)
    26.             {
    27.                 case LeanTiming.Update:
    28.                     return Time.deltaTime;
    29.                 case LeanTiming.FixedUpdate:
    30.                     return Time.fixedDeltaTime;
    31.                 case LeanTiming.UnscaledUpdate:
    32.                     return Time.unscaledDeltaTime;
    33.                 case LeanTiming.UnscaledFixedUpdate:
    34.                     return Time.fixedUnscaledDeltaTime;
    35.                 default:
    36.                     return Time.deltaTime;
    37.             }
    38.         }
    39.  
    40.         protected override void Update()
    41.         {
    42.             remainingTime -=  DeltaTime(update);
    43.  
    44.             if (remainingTime <= 0.0f)
    45.             {
    46.                 BeginTransitionsAndEvent();
    47.             }
    48.         }
    49.  
    50.         void BeginTransitionsAndEvent()
    51.         {
    52.             remainingTime = timeInterval + remainingTime % timeInterval;
    53.  
    54.             BeginTransitions();
    55.  
    56.             if (onAnimation != null)
    57.             {
    58.                 onAnimation.Invoke();
    59.             }
    60.         }
    61.     }
    62. }
    63.  
    64. #if UNITY_EDITOR
    65. namespace Lean.Transition.Extras
    66. {
    67.     using UnityEditor;
    68.  
    69.     [CanEditMultipleObjects]
    70.     [CustomEditor(typeof(LeanAnimationRepeater))]
    71.     public class LeanAnimationRepeater_Inspector : Lean.Common.LeanInspector<LeanAnimationRepeater>
    72.     {
    73.         protected override void DrawInspector()
    74.         {
    75.             Draw("remainingTime", "When this reaches 0, the transitions will begin.");
    76.             Draw("timeInterval", "The time in seconds between each animation.");
    77.             Draw("update");
    78.  
    79.             EditorGUILayout.Separator();
    80.  
    81.             Draw("transitions", "This stores the Transforms containing all the transitions that will be performed.");
    82.  
    83.             EditorGUILayout.Separator();
    84.  
    85.             Draw("onAnimation");
    86.         }
    87.     }
    88. }
    89. #endif
     
    Last edited: Feb 28, 2021
  37. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    These are private, so you must modify the code to access them. It's in LeanTransition.cs unscaledUpdateStates/unscaledLateUpdateStates/etc.


    There's no equivalent in LeanTouch+. You can try LeanHover ("20 Hover" demo scene) from LeanGUI though. You can add a PhysicsRaycaster to make this work with 2D or 3D.


    LeanAnimation isn't a transition, so it won't automatically execute, only transitions do. You can use the EventTransition to execute it, and this can also be used to activate your GameObjects.

    You can disable the LeanAnimationRepeater component to stop it starting new transitions. Stopping the transitions that are in progress requires code though, since you need a reference to the transition state in order to stop it.


    Probably not, that's a good way to do it!
     
    restush96 and laurentlavigne like this.
  38. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    275
    Something bizarre here. This bit of code causes TranslateTransition to occur in slow motion. When I remove line 5 (collider disable), it goes back to normal speed. I don't understand how a collider would affect the playback time. This is the entire script and it's the only script on the gameobject.

    EDIT: This has been resolved. Normal speed was actually 6x speed because it was triggering multiple times and adding together all the transforms.

    Code (CSharp):
    1. public GameObject raven1;
    2.  
    3. void OnTriggerEnter()
    4. {
    5.     GetComponent<Collider>().enabled = false;
    6.     raven1.transform.TranslateTransition(raven1.transform.localPosition.x, 8f, 6f, 6f, LeanEase.Linear);
    7. }
     
    Last edited: Mar 3, 2021
    Darkcoder likes this.
  39. neapolitanstudios

    neapolitanstudios

    Joined:
    Feb 17, 2011
    Posts:
    57
    @Darkcoder I am currently utilising a bunch of your assets in a current project. I'm a big fan so far!

    I'm having an issue with LeanGUI. I am trying to create a drag menu with buttons. I have used the swipe screens example (#28) for the menu dragging; which works perfectly until I add a LeanButton component onto the buttons in the menu. The buttons seem to activate in place of the drag. I've tried the LeanPriority component and it doesn't seem to make a difference. I've also tried disabling the buttons on drag, but that also doesn't do anything. Do you have any suggestions in regards to altering the priority of buttons vs drag scroll?

    I've attached an image of what I have (if that helps).

     
    Last edited: Mar 4, 2021
  40. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457

    This happens because LeanButton listens for the OnDrag events, so it 'captures' it. LeanButton.cs has code to pass this drag information down to a ScrollRect, but no other component. I've attached a modified component that also passes this to LeanButton, let me know if it works. In the future perhaps I should make it auto send to any parent component with drag, or allow you to specify some, not sure.
     

    Attached Files:

  41. neapolitanstudios

    neapolitanstudios

    Joined:
    Feb 17, 2011
    Posts:
    57
    Thanks! That works a treat! :)

    If you do make those changes, you should include a carousel example. That's what I'm currently working on, and I can see it being a good resource for mobile developers.
     
  42. OBJVISION

    OBJVISION

    Joined:
    Oct 5, 2020
    Posts:
    4
    any news?
     
  43. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Yeah, I'd like to make many more demo scenes, finding time to make them is more tricky though :D
     
  44. Proto-G

    Proto-G

    Joined:
    Nov 22, 2014
    Posts:
    146
    Hey, awesome assets, thanks so much!

    I'm trying to figure out how to toggle off all toggles in the scene when I toggle one on. I have several canvases with several toggles on each. I'm trying to use the event system for lean toggle and lean button, but not able to get it working. I've tried using string name for TurnOffAll() but not working also...
     
  45. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    TurnOffAll(string) allows you to turn off all toggles with the specified name, there's no method that does what you describe. The attached package adds the new TurnOffOthersNow method that does this though.
     

    Attached Files:

    Proto-G likes this.
  46. Proto-G

    Proto-G

    Joined:
    Nov 22, 2014
    Posts:
    146
    Awesome! Thanks so much, I'll give it a try shortly.
     
  47. Proto-G

    Proto-G

    Joined:
    Nov 22, 2014
    Posts:
    146
    It's working to turn off others, but is also turning off the selected one to be toggled...
     
  48. Proto-G

    Proto-G

    Joined:
    Nov 22, 2014
    Posts:
    146
    I'm trying to:
    Click toggle button - turn on toggle, turn off all other toggle
    then if Click again - turn off toggle
    Currently I can:
    Click toggle button - turn on toggle, turn off other toggle
    but cannot toggle back off

    Current Inspector setup:
    On Down - current toggle = TurnOffOthersNow
    On Down - current toggle = Toggle
    (but toggle doesn't toggle back off)

    If I setup like this, then toggle doesn't toggle on:
    On Down - current toggle = Toggle
    On Down - current toggle = TurnOffOthersNow
    (but toggle doesn't toggle on)
     
  49. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Oops, try the attached script!
     

    Attached Files:

    Proto-G likes this.
  50. Proto-G

    Proto-G

    Joined:
    Nov 22, 2014
    Posts:
    146
    Yes! This works perfect, thanks so much!
     
    Darkcoder likes this.
unityunity