Search Unity

LEAN ⚡️ Touch / GUI / Texture / Localization / Transition / Pool

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

  1. premk

    premk

    Joined:
    Jan 4, 2015
    Posts:
    4
    I am also searching for an answer to that. How can i handle tap and double tap in game.
     
  2. Prot0Type

    Prot0Type

    Joined:
    May 18, 2017
    Posts:
    4
    Hey, Im using Lean Touch+
    I got a Lean Pitch Yaw Smooth working with my camera. In my app I switch between different scenes and go back to the scene with the Pitch Yaw script. When I return, id like to have the same camera angles from the time I left the scene.
    Is there a way to declare some variables static to quickly solve this?
    Great Asset btw.:)
     
  3. Bentoon

    Bentoon

    Joined:
    Apr 26, 2013
    Posts:
    98
    Just saw the answer to many of my questions Beautifully illustrated in the + examples! Thanks again

    ~be
     
    Darkcoder likes this.
  4. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    This can be done with LeanTouch+ using the LeanFingerTapExpired component. This is shown in the TapToRotateExpired demo scene.


    Try the attached component. You can add this alongside your LeanPitchYaw component, and if you set the SaveName setting to something then it will auto save/load the Pitch & Yaw values.
     

    Attached Files:

  5. Prot0Type

    Prot0Type

    Joined:
    May 18, 2017
    Posts:
    4

    Hey thanks a lot,
    but I got an error in this script: LeanTouch.ComponentPathPrefix (line 6).
    Is this because my targetplatform is android?
    Sorry to bother you, I write a nice review in the asset store ;)
     
  6. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    This is because you're using an older version of LeanTouch, where LeanTouch.ComponentPathPrefix doesn't exist. Try deleting line 6 from this source file (it's not that important), and it should work.

    Also, thanks for the review ❤️
     
  7. kkl888

    kkl888

    Joined:
    Dec 6, 2014
    Posts:
    55
    Hi @Darkcoder, after I open and close notification bar in iOS while my game is displaying, it always returns a list of 2 LeanFinger in LeanTouch.OnGesture, even only one finger is touching the screen. Is it expected feature or bug?
     
  8. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Probably a bug, this is using the latest version right? You can check this in the documentation Versions list.
     
  9. kkl888

    kkl888

    Joined:
    Dec 6, 2014
    Posts:
    55
    Yes, i reimported the asset from unity asset store and having same issue. Should b 2.0.3
     
    Darkcoder likes this.
  10. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Alright, I sent you a private message with an updated build. This contains additional code that should account for any scenarios where Unity gives weird data. Let me know if it works :)
     
  11. kkl888

    kkl888

    Joined:
    Dec 6, 2014
    Posts:
    55
    The issue is fixed in the updated build! Thanks alot for ur help =)
     
    Darkcoder likes this.
  12. si_eta

    si_eta

    Joined:
    Oct 29, 2019
    Posts:
    2
    still having same issue about "missing" function. :(
    I am using Unity 2019.2.5f1 and Lean Touch 2.0.3 import and download yesterday (28/10/2019)
     
  13. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Great! I'll submit the fix soon, thanks for your help :)


    This is a bug with certain versions of Unity. You can read about it HERE. If you update to newer versions then it should work.
     
    kkl888 likes this.
  14. magicgirlallison

    magicgirlallison

    Joined:
    Nov 14, 2018
    Posts:
    1
    Hi there! Is there a way we can get the Tooltip Data text field to accept variable content? Like I want to be able to include something like [var=PlayerName] inside the tooltip and have it show the content of the Variable.
    Thanks!
     
  15. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Lean Localization comes with a system like this, called a 'token'. You can add Lean Localization to your project, then add the attached component. To get it to work without code:

    1 - Add the LeanLocalization component to your scene.
    2 - Click Add next to Languages, and select English.
    3 - Type PlayerName into the Tokens box, and click Add.
    [optional] - You can type in the default player name here.
    3 - Go back to the LeanLocalization component, and type something like PlayerTooltip into the Translations box, and click Add.
    4 - Click the Create button next to the English translation for the new phrase, and type in something like: Hello there {PlayerName}!
    5 - Add the new LeanLocalizedTooltipData component to your LeanTooltipData GameObject, and from the translation list pick PlayerTooltip.

    It should now work, and you can set the PlayerName GameObject's LeanToken component's Value property, or call the SetValue methods if you want to set it from inspector events.

    If you only want English and don't mind doing this from code, then steps 3-5 can be skipped, and you can directly set the yourTooltipData.Value = LeanTranslation.FormatText("Hello there {PlayerName}!", yourTooltipData.Value, yourTooltipData);
     

    Attached Files:

    NaucMeCZ likes this.
  16. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Hey everyone,

    Lean GUI Shapes has just been released!

    This new asset allows you to quickly add lines, rounded boxes, polygons, and much more to your GUI!

    Get it while it's cheap, as I have plans to increase the price as I add more features!

    Each shape is procedurally/dynamically generated, so you don't have to worry about managing many textures. You also have lots of control over each visual setting, allowing you to quickly experiment with different UI styles.

    If you have any ideas for demo scenes, features, etc for this new asset then please let me know.


    P.S. If you purchase it then please consider writing a review, they really help me out, especially for new assets :)
     
  17. Baesickkk

    Baesickkk

    Joined:
    Oct 1, 2019
    Posts:
    4
    Hi! Can you integrate Lean Touch into Playmaker by making custom actions for it? The developer of Playmaker said they're willing to help to keep things going for you. :)
     
  18. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    What kind of actions would be useful? And what kind of interactions are you trying to do that you currently can't?

    I have a copy of Play Maker, so I could add some. However, Lean Touch has an immense amount of components and methods, so I can't add everything. I'm not too familiar with Play Maker, but if there's a way to make a few useful actions and have them be flexible enough to allow many things then I could do it.

    Most features of Lean Touch are designed to work without any code, and many components have events that should work with Play Maker, so it may not be necessary to add any custom actions for most things.
     
  19. Baesickkk

    Baesickkk

    Joined:
    Oct 1, 2019
    Posts:
    4
    Common gestures (like tap, touch...) would do. I've read some of the post that came from the Playmaker community who's asking for a LeanTouch Custom Action support...some of them are newbies who doesn't even know what events is and are having a hard time implementing gestures to their projects. While some of the assets in the Asset Store who offers the same functionality (with Playmaker Custom Action) just as LeanTouch which costs us a lot, maybe it would be beneficial for people (who are into visual scripting) if Lean Touch will have a custom actions so that we don't have to make one and instead, we could just focus on what where actually doing. :)
     
  20. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    LeanTouch already has components that provide events for tap (LeanFingerTap > OnFinger, OnPosition), and touching objects (LeanSelectable > OnSelect, OnSelectSet, OnSelectUp, OnDeselect). These events can be used to trigger changes in almost any other component using only the inspector, including Play Maker, so I don't see how adding an action for this would be beneficial.
     
  21. Play2D

    Play2D

    Joined:
    Oct 16, 2016
    Posts:
    9
    Hi, thanks for the great assets. I'd like to report a slight issue with LeanPool. After adding the 'LeanGameObjectPool' script and trying to add GameObjects, it doesn't allow me to until I switch the notification type back and forth (at least that's how I've fixed it). It then allows me to assign a GameObject, but then it gives another error message. I think everything works fine after that, yet it's a slight annoyance I wanted to share.

    Here's a link to a video showing what I described:
     
  22. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Thanks for pointing this out, I will submit a fix today!

    I've attached an updated LeanGameObjectPool.cs you can copy+paste into the Lean\Pool\Scripts folder to fix this.
     

    Attached Files:

  23. Play2D

    Play2D

    Joined:
    Oct 16, 2016
    Posts:
    9
    Excellent! Seems to be working well now. Thanks for the prompt response and fix.
     
    Darkcoder likes this.
  24. Gamrek

    Gamrek

    Joined:
    Sep 28, 2010
    Posts:
    164
    Hi

    Thanks for writing this plugin. I just updated and it give me "The name instance does not exist in the current context" in LeanHelper.cs. Can you please fix this? Thanks.

    Derek
     

    Attached Files:

  25. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Which exact version of Unity are you using?

    *reminds self to never trust the Unity documentation*
     
  26. Jon-Gao

    Jon-Gao

    Joined:
    Dec 9, 2012
    Posts:
    17
    @Darkcoder
    I have same problem, my self using Unity 2018.4.10f1
     
  27. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Here's an updated LeanHelper.cs, just copy+paste it into Lean\Common\Scripts. I'll submit a fix new, sorry for the issues!
     

    Attached Files:

  28. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    I came here to report the LeanHelper.cs bug.
    Lean pool is still my preferred pool manager! Thanks a lot! :)
     
    Darkcoder likes this.
  29. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Updated versions of all the Lean assets are now out :)

    [Edit] It looks like I made a very stupid mistake in the latest version, that I've now submitted a fix for.

    If you encounter compile issues, then either install the LeanHelper_Fixed package attached to this post, or copy+paste the attached LeanHelper.cs file into the Lean/Common/Scripts folder.

    Sorry for any issues!
     

    Attached Files:

    Last edited: Nov 13, 2019
    Appokalopps and atomicjoe like this.
  30. NoConscience

    NoConscience

    Joined:
    Mar 16, 2019
    Posts:
    14
    Is there a way to stop the transition early in Lean Transition?
     
  31. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    You can stop a transition by setting the .Skip = true setting on the transition state. To get a transition state, either:

    a) When you begin a transition you can get a reference to it by adding the .GetTransition() method to the end of your transition call.
    b) After you add your transition then you can get it from: LeanTransition.CurrentHead

    If your transition is joined to others then you can loop through the Prev and Next lists inside the transition state. In a future version I'll add a method to make this easier to do.
     
    chrisnathan1983 likes this.
  32. NoConscience

    NoConscience

    Joined:
    Mar 16, 2019
    Posts:
    14
    Thank you so much!!
     
    Darkcoder likes this.
  33. NoConscience

    NoConscience

    Joined:
    Mar 16, 2019
    Posts:
    14
    Hi. Thanks for make this asset. It's very useful!

    In Lean Transition, Can I create a custom Transform like Lean Transform LocalPosition?
     
  34. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Sure, as long as you understand C#.

    Take a look at the LeanTransformLocalPosition.cs code to see how it works. The transition itself is done inside the UpdateWithTarget method, where it transitions between the oldPosition and Position values. oldPosition is set from the BeginWithTarget method, and Position is set from the inspector, or auto filled from the AutoFillWithTarget method. The code at the bottom of the file defines the extension methods to give you yourTransform.localPositionTransition(...), etc.

    To make a new transition I recommend you duplicate an existing transition, then change the important bits like the component it works on to your new one (e.g. Transform), the name of the class + extension method, the variable type and identifiers for the transition (e.g. Vector3 Position, Vector3 oldPosition), and then the actual transition code (e.g. Target.localPosition).
     
  35. FaberVi

    FaberVi

    Joined:
    Nov 11, 2014
    Posts:
    146
    Hello, it's possible rotate object 3D with one axys and only with single tap/drag? I use LeanTouch+
     
  36. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    The DragTurn1D demo scene shows you how a horizontal drag gesture can rotate your object around a custom axis. If you want a one finger twist gesture, then the MultiTwistOneFinger demo scene shows you how to detect it using the LeanMultiTwist component. Although this example shows you how to rotate a UI element, you can use the LeanMultiTwist.OnTwistDegrees event to rotate a 3D object using the LeanManualRotate component (RotateA function), similar to how the DragTurn1D demo scene works :)
     
  37. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Hey everyone,

    I decided to make a LeanTouch example demonstrating how to integrate Vuforia with multiple image targets, each with an object on top that can be selected, translated, and rotated relative to the card it's on.

    Although this demo makes use of LeanTouch+ components for translation, the rotation should still work if you only have LeanTouch.

    Enjoy!
     

    Attached Files:

  38. khanhabib

    khanhabib

    Joined:
    Oct 11, 2018
    Posts:
    29
    Hello, i want to Rotate object through "Lean Twist Rotate Axis.cs" script, by using single finger swipe Left or Right on screen. How to do it. Thanks
     
  39. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    This can be done using LeanTouch+ with the LeanFingerSwipe and LeanManualRotate components.

    This is shown in the Touch+/Examples/SwipeTurn demo scene. To make the rotation 1D as you describe, select the Red Cube/Swipe = Turn GameObject, and set the LeanManualRotate.AxisB setting to 0,0,0.

    You may also need to change LeanManualRotate.Space to Local depending on your setup.
     
    khanhabib likes this.
  40. FaberVi

    FaberVi

    Joined:
    Nov 11, 2014
    Posts:
    146
    Besides the swipe, is it possible to carry out the same operation with the drag? Ah also in the script "LeanManualRotate" the method RotateAB not exist. (but is used and give me Missing in event list)
     
    khanhabib likes this.
  41. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Yes, this is shown in the LeanTouch+ examples DragTurn1D and DragTurn2D :)

    This is a bug with certain versions of Unity. You can read about it HERE. If you update to newer versions then it should work.
     
  42. unity_rsenoron

    unity_rsenoron

    Joined:
    Oct 24, 2019
    Posts:
    6
    Hi,

    Thanks for this asset! I have one problem which I can't figure out though regarding 'lean selectable'.

    I created an empty object in the canvas. Put a 2D collider in it since I want this to be the parent. I added 'child' objects like images etc. The object I am creating is a 'card' like a ccg card. I already set the 'lean select' to use all three, canvasUI, Raycast3D, and Overlap2D but the problem is I can't seem to select the parent. I am not sure what I am missing. Can you help me on this. Thanks.
     
  43. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    It sounds like you might be mixing together Canvas and Physics2D elements, which may not work. Everything inside the canvas should just be UI components like Image, Text, etc. To add 'colliders' to these, you enable Raycast Enabled on the Graphic (e.g. Image).

    Perhaps a video or screenshots or sending me a package I can test would make it easier to understand what's going on?
     
  44. unity_rsenoron

    unity_rsenoron

    Joined:
    Oct 24, 2019
    Posts:
    6
    I did try,

    Creating a UI image as a parent(add the 'lean selectable') and add 'child' UI elements to it. But I can't seem to select the parent. From my observation, if you put the 'lean selectable' in the element which is in the lowest part of the hierarchy, it will get selected. I don't want this because I want all elements to move together via a parent.
     
  45. francoiscoiscois

    francoiscoiscois

    Joined:
    Oct 23, 2019
    Posts:
    38
    Hi, Do you have plans to add playmaker support ? There is at the moment no touch gesture asset that work with playmaker at the moment. I would be really interested to buy your asset if I could use on my project with playmaker. Other playmaker user would certainly be interested as well...
     
  46. wallabe

    wallabe

    Joined:
    Oct 6, 2017
    Posts:
    6
    Any update on this feature? I need it for my project too.
     
  47. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Ah, make sure you change LeanSelect.Search to GetComponentInParent, then it will search parents too.


    LeanTouch is designed to work without the need for PlayMaker or C# scripts. If you need to have some custom action made in PlayMaker/C#, then you can call them from the events provided by LeanTouch. For example, the LeanSelectable component has the OnSelect event, which can be used to trigger some kind of FSM action to do what you want when you select your object. I don't use PlayMaker so I don't know the exact function you must call, but I imagine it's easy enough. Most other LeanTouch components have events like this too.


    The new MultiTwistOneFinger demo scene shows you how to do this with the new LeanMultiTwist.OneFinger setting :)
     
  48. Miguelfanclub

    Miguelfanclub

    Joined:
    Jun 14, 2015
    Posts:
    64
    Cant spawn exactly from the pos where Game Object Pool is attached to. It always spawn somewhere in the space.

    Edit: When setting Preload number, then it will always spawn from 0,0,0

    Edit2: It just doesnt work. WHen deSpawning and spawning again it goes back to 0,0,0
     
    Last edited: Dec 5, 2019
  49. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    How are you spawning your objects?

    From code or editor? From LeanPool or LeanGameObjectPool?

    If you just call Spawn(), then it will use the LeanGameObjectPool's Transform.position + rotation.

    If you want a different position then you can use Spawn(position, rotation, [parent], [worldPositionStays]).

    The code for these looks fine.
     
  50. Miguelfanclub

    Miguelfanclub

    Joined:
    Jun 14, 2015
    Posts:
    64
    Doing it from code. First spawn is fine, the second spawn goes to a werid postion if I select Preload/Max Capacity or if I manually do pool.DespawnAll();

    I simply do:

    public LeanGameObjectPool pool;

    then:
    private void spawn()
    .
    .
    pool.Spawn();