Search Unity

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

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

  1. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    343
    I'm trying out Volumetric Audio with a simple mesh but encountering issues.

    Using Blend or Volume fade causes the sliders to jump from 0 to 1 when crossing the mesh boundary in certain places. I tried it with a square mesh and couldn't reproduce the issue so I'm guessing it's a problem with my fancy mesh (it's a large horseshoe-shaped mesh).

    I have confirmed the mesh is closed so I'm wondering if there's any other gotchas with mesh volumes.

    EDIT: This is happening with the demo scenes too, if I scale them up to a large size (2000 units) so I guess it's not related to mesh colliders. I'll keep experimenting with different setups.
     
    Last edited: Apr 4, 2022
  2. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Wrong forum thread. You can email or private message me the model so I can test it.
     
  3. cihadturhan_unity

    cihadturhan_unity

    Joined:
    Apr 19, 2021
    Posts:
    64
    Hi @Darkcoder
    I'd like to implement "resize handle" functionality like in this example:
    http://jsfiddle.net/ft4hzm8d/

    I've bought pro version but couldn't find any similar example to this.
    Could you guide me to how to do that?
     
  4. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Lean GUI comes with a resize handle feature, but it only works for one corner or edge. Making it work for multiple points is much more difficult and is on my to-do list, but it's not a high priority right now.
     
  5. cihadturhan_unity

    cihadturhan_unity

    Joined:
    Apr 19, 2021
    Posts:
    64
    Oh sorry I forgot to say that, I need this functionality for Lean Touch!
     
  6. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    The easiest way to implement this is to make draggable objects for your drag handles, and then separately position the main object based on these. You would then also want to re-position the other drag handles based on this new position. This is kind of game-specific and not that related to touch controls, so it's unlikely I will add it soon.
     
  7. cihadturhan_unity

    cihadturhan_unity

    Joined:
    Apr 19, 2021
    Posts:
    64
    Thank you Carlos,
    I made it work with some custom coding.
     
    Darkcoder likes this.
  8. vividbloom

    vividbloom

    Joined:
    Dec 7, 2012
    Posts:
    1
    I have a problem with LeanLocalization.
    I have a GameObject with the LeanLocalizedTextMeshPro component as a child of a canvas group.
    The alpha of the canvas group has no effect on the Lean TMP component. Am I missing something?
    I am using 2021.3.0f1 but this behaviour is also present with 2020.3.3f1.

    EDIT:
    User error on my part. I'll just have to use LeanLocalizedTextMeshProUGUI instead.
     
    Last edited: Apr 26, 2022
    Darkcoder likes this.
  9. pretender

    pretender

    Joined:
    Mar 6, 2010
    Posts:
    865
    Hello friends, I was wondering about LeanTouch, is there a possibility to for example have something like this:
    Code (CSharp):
    1. LeanTouch.OnSingleFingerDragStart += OnSingleFingerDragStart;
    2. LeanTouch.OnSingleFingerDrag += OnSingleFingerDrag;
    3. LeanTouch.OnSingleFingerDragEnd += OnSingleFingerDragEnd;
    I used some other packages like this, it seems a bit complicated to use, I would like this functionality out of the box
    or I am missing something!

    Thank you!
     
    cihadturhan_unity likes this.
  10. pretender

    pretender

    Joined:
    Mar 6, 2010
    Posts:
    865
    or at least to use some of your components to wire drag delta, and i want event when drag starts and ends for single and two finger drag. any help appreciated!
     
  11. Bentoon

    Bentoon

    Joined:
    Apr 26, 2013
    Posts:
    98
    Hello Carlos & everyone
    Thanks for this asset and your help
    I have been using Lean touch + for a while (specifically the Camera's functions).
    Now I'm trying to switch back and forth between the (04.Relative scene) and having predefined camera positions that change w the LeanTransform.localPosition / lean.Transform.localRotation array w an ie.numerator pause between them.

    I can't crack the logic though.Maybe I'm missing a scene that does something similar
    Any guidance is appreciated.

    best

    ~be
     
  12. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    You can use OnFingerDown + OnFingerUpdate + OnFingerUp, or OnGesture for multiple fingers. If you really need to know if it moved you can check the delta, but in reality it's very difficult to keep fingers still on a touch screen so it's usually not worth it to differentiate touching from dragging.


    You'll have to explain what the issue is? You should be able to move the Camera Pivot without issue, though LeanPitchYaw takes over the Transform's rotation, so you cannot set localRotation, you would have to set the Pitch & Yaw.
     
  13. chgeorgiadis

    chgeorgiadis

    Joined:
    Jan 30, 2018
    Posts:
    51
    Can i use two methods for lean touch?
    My use case:
    I have some buttons in an AR App which i spawn through a UI. When a button is spawned it can drag translate over a plane and it changes position with pressing. So i added a "Press to select" object and the "drag translate along" script. I also added a Pinch scale script in order to change the size. But the users are complaining because on mobile the spawned buttons are too small and they can not pinch them. So i would like to ask if it is possible to add the "Tap to select" option in order to select a button with this (tapping two times) and scale it using whole the screen and not only the "surface of the button". (and of course deselect it tapping on an empty screen) Is that possible?

    P.S. I added the finger tap script on my "Press to select" object but didnt make the trick.
     
  14. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    If you use the tap to select setup then LeanPinchScale will use the whole screen. You can copy+paste the Tap To Select setup from one of the example scenes and change the LeanFingerTap's RequiredTapCount or RequiredTapInterval to 2 to make it activate using double tap. Your scene should now work as you describe?
     
  15. chgeorgiadis

    chgeorgiadis

    Joined:
    Jan 30, 2018
    Posts:
    51
    Yes, exactly that is the reason (LeanPinchScale using the whole screen) that i want to use Tap to Select. But i need to have Press to select also. Is that possible? I want to drag it pressing it through a plane ("Press to select" and Drag Translate Along Plane ) but i want to add the Tap to Select option in order to scale it (pinch scale) when i want to.
     
  16. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    452
    Not sure what happened but when I try to run a debug session in Visual Studio and it tries to do a build before it starts I get:

    /Users/username/DevelopmentFTG//Assets/Plugins/CW/LeanCommon/Extras/Scripts/LeanFormatString.cs(6,6): Error CS0246: The type or namespace name 'CW' could not be found (are you missing a using directive or an assembly reference?) (CS0246)

    I get many of these and then of course all the errors that come with it. I'm installing LeanTouch+ by the way. It works fine in Unity but when I try to build it in VS I get this error and can't debug. I'm using Unity 2020.3.23f1 with latest LeanTouch+

    Any idea what the problem could be? If I go to LeanFormatString I see "using CW.common;" and it's not highlighted as an error, so I'm thinking it might be a linker issue?
     
  17. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    452
    Damn! It never fails. Every time I eventually post asking a question, things start working. Not sure what happened but the issue just went away. Strange...
     
    Darkcoder likes this.
  18. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Yes, you can add both selection styles to the same scene. They might conflict in some scenarios though, I'm not sure.


    Sounds like when you installed Unity you forgot to uncheck the optional invisible 'gremlins' that love to mess up your day :D
     
    JesterGameCraft likes this.
  19. AlexWalton

    AlexWalton

    Joined:
    Jul 7, 2019
    Posts:
    3
    Is there a way to expand the selectable area of a LeanSelectableByFinger component?

    For example, I have an object that I use for a drag to throw type game. I'd like to be able to start dragging the object by clicking / touching the screen anywhere around the object.

    Photo Example

    Loving lean touch so far, thanks!
     
  20. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    For 3D objects, LeanSelectableByFinger works using a raycast against your object's colllider(s). Therefore, to expand the selectable area you must make the collider bigger.
     
  21. hamalast

    hamalast

    Joined:
    Jun 11, 2017
    Posts:
    1
    Hello.
    I bought Lean Touch + and am trying to install it.

    I want to move the Panel of uGUI by dragging.
    Two methods came to my mind, but neither worked.

    ===

    1. Link and use components
    I tried attaching the "Lean Drag Translate" component.
    However, the camera could not be set.
    The reason is that we are using multi-scenes, and the camera body is in the parent scene for management.

    After the scene is loaded, the camera of the parent scene / child scene Canvas is set as the camera of the parent scene.
    Is there a way to set the Lean Touch + component's camera from a script?

    2. Drag event
    I wanted to move a RectTransform using a script drag event.
    The following code was able to detect and process the tap event.

    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using Lean.Touch;
    4.  
    5. public class ButtonWrapper : MonoBehaviour
    6. {
    7.     void OnEnable()
    8.     {
    9.         LeanTouch.OnFingerTap += HandleFingerTap;
    10.     }
    11.  
    12.     void HandleFingerTap(Lean.Touch.LeanFinger finger)
    13.     {
    14.         if (finger.IsOverGui)
    15.         {
    16.             Debug.Log("You just tapped the screen on top of the GUI!");
    17.         }
    18.     }
    19. }
    However, when I checked LeanTouch.cs, I couldn't find OnFingerDrag.
    Is there a sample to move the RectTransform from the script?

    ===

    I'm sorry if you asked a misguided question.

    I like the ease of use in Lean Touch scripts!
    So I would be happy if there was a solution for the second method.

    I would appreciate it if you could answer.

    Thank you.
     
    Last edited: May 17, 2022
  22. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    The LeanDrag component from the Lean GUI asset can be used to do this.

    This can also be done with Lean Touch (see the "23 Transform Relative" demo scene), though it's a little more difficult to configure due to the default UI layer being ignored by most Lean Touch components.
     
  23. ZaoTX

    ZaoTX

    Joined:
    Mar 4, 2022
    Posts:
    3
    Hi Guys!
    Is that possible that LeanTouch not compatible with Gyroscope?
    In order to detect the activity we used Gyroscope to detect the camera position and rotation(in our case iPhone or iPad)
    However, Gyro.rotationRate.magnitude always returns 0 when running an empty project with LeanTouch.
    Does anyone have any ideas? Thank you very much!
     
  24. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    343
    I want to use a material with a texture on LeanBox but it only displays a flat color. I have an Image component beside it with the same RectTransform and same material that displays correctly. Am I misunderstanding what kind of material LeanBox requires?
     
  25. ai071658

    ai071658

    Joined:
    May 1, 2022
    Posts:
    1
    upload_2022-5-20_23-54-5.png
    Why does SelectScreenPosition not appear in On Finger function
    I want to tap cube and call cube's script.
     
  26. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    The gyroscope isn't related to touch controls so no. I've attached a component I made a long time ago that can give you gyro data, but there are no examples for it so you're on your own.


    LeanBox (and all other shapes) use a texture to render the blur, so it's not possible to render a second texture. It would be possible using a custom shader/material for each shape, but that would be pretty bad for performance. The only thing you can do is to use LeanBox as a mask for your image.


    You're using the LeanSelect component, which doesn't have any code to handle fingers. You want to use the LeanSelectByFinger component instead. Your selectable objects should also use the LeanSelectableByFinger component if you want them to receive finger data too.
     

    Attached Files:

  27. ramahani

    ramahani

    Joined:
    Mar 9, 2022
    Posts:
    2
    Hey Carlos,
    First of all I really want to thank you for creating lean touch it has helped me so much. I’m struggling a bit with something and I hope you can help me. My game has 6 cubes that need to move by using my touch so I used the lean drag translate component and it’s working perfectly fine. I also am using the lean selectable by finger so that I can move each cube on its own. My problem here is that when I select a cube I want to trigger an animation but I’m unable to figure out how can I do this, like is there any methods that I can call or something so that when the cube is selected I can trigger an action? Thank you so much
     
  28. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    I just answered you via email :)
     
  29. TiggyFairy

    TiggyFairy

    Joined:
    Dec 22, 2019
    Posts:
    505
    Hello! Lean GUI doesn't seen to come with a way to add anything to a scene. Can you tell me how to do that? I can copy a button from the demo, but that seems like it might be awkward.

    Untitled2.png
     
    Last edited: May 24, 2022
  30. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    518
    I got several selectable objects with LeanSelectableByFinger component attached. I need to scale the background (behind all the selectable objects) on pitch. I use custom script for that but same using LeanSelectableByFinger on it.

    How can I ignore scaling if any other object is selected?
     
  31. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    518
    Is this thread alive?
     
  32. TiggyFairy

    TiggyFairy

    Joined:
    Dec 22, 2019
    Posts:
    505
    I'm staring to think not......
     
  33. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Sorry for the late reply.

    There are no GameObject creating menu options for Lean GUI. It's on my to-do list to create some kind of pack of buttons or something you can easily drag and drop, but there are many higher priority issues to do first.


    I answered you via email!
     
  34. TiggyFairy

    TiggyFairy

    Joined:
    Dec 22, 2019
    Posts:
    505
    Ah, okay, thank you!
     
  35. Quast

    Quast

    Joined:
    Jul 5, 2015
    Posts:
    560
    Hi,
    Code (CSharp):
    1.                 Ball.GetComponent<LeanBox>().Color......
    2.  
    I'm tryin to reach the LeanBox script but it doesn't show!! How to solve this?
     
  36. Quast

    Quast

    Joined:
    Jul 5, 2015
    Posts:
    560
    Any help with this?
     
  37. MazanderEntertainment

    MazanderEntertainment

    Joined:
    Feb 13, 2019
    Posts:
    3
    Hello, I cannot find Lean GUI and I would like to implement a virtual joystick
     
  38. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    All LeanGUI code is within the Lean.GUI namespace. This code is also all inside the LeanGUI assembly/asmdef which you need to reference if you're using your own assembly.


    You can go to my publisher page in my signature (MY ASSETS) to get it?
     
  39. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    518
    @Darkcoder why LeanFingerTap attached to a specific object is triggered even if user click any other collider in the parent object? LeanSelect layer is set only to that specific object layer and the rest colliders should be ignored at all
     
  40. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Prebuy question for this really cool asset.

    Does this work in Runtime on WebGL and mobile? and how is the performance.
     
  41. shyn3ss

    shyn3ss

    Joined:
    Jun 4, 2020
    Posts:
    2
    Hi,
    I'm having some trouble with DragAndTranslate.

    My game is a classic runner that uses a game object with the mentioned script that moves along the x axis as the player drags.
    Well, the problem is that I want the player to be able to drag from every point of the screen (except HUD elements), but some other 3D elements in the screen (like any kind of obstacles) seems to be blocking the raycast and prevent the player to drag if he starts from such 3D objects. I've noticed that if I start draging at the bottom of the screen (where the player is positioned) I have no problems, no matter the 3D object is at that moment in that position.

    I've also noticed that if I start dragging on top of the screen over the skybox background it also works. So my guess is that the 3d objects are blocking it somehow. I'm using layers to control the physics and collisions, could this be a problem? Is there a component I have to include in the 3d objects that seems to be blocking the touch points to get the desired behaviour?

    Thank you!
     
  42. Sathwick-p

    Sathwick-p

    Joined:
    May 31, 2022
    Posts:
    1
    I am using Lean touch scripts (rotate, scale, translate) and within the same scenes i have buttons too however, when i add the eventSystem the buttons work fine but all lean touch functionality stops working, how do I use lean touch along with the Event System?
     
  43. creativelefty

    creativelefty

    Joined:
    Jan 28, 2017
    Posts:
    10
    How would I go about referencing a gameObject's LeanSelectableByFinger script component? I tried setting up a variable as a LeanSelectableByFinger component type and drag/drop the gameObject's attached LeanSelectableByFinger script but VisualBasic just shows errors. So then I also tried to add a LeanSelectableByFinger script component to a gameobject at runtime (gameObject.AddComponent <LeanSelectableByFinger>();) but that also doesn't work. I would also like to know how I am able to change the 'isSelected' state manually using script (hence why I am trying to reference the script). Any ideas? Cheers.
     
  44. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    LeanFingerTap doesn't care what GameObject you add it to. This component only detects when you tap the screen, it doesn't perform any raycast.

    Yes. It's just detecting touch controls so it shouldn't really impact performance.


    The LeanTouch component has the GuiLayers setting. If you drag your finger over any object in one of these layers, then most components will ignore that finger (based on the IgnoreOverGui or similar settings).


    All the example scenes have an Event system, so you should examine them compared to your scene and find where the issue is. Typically it's because you've added a full screen UI element that is blocking fingers.


    Without know what these 'errors' are I have no idea.
     
  45. pako

    pako

    Joined:
    Nov 21, 2012
    Posts:
    111
    Hi,

    I'm using Lean Joystick (Lean GUI) in a project. More specifically, I get the ScaledValue from the Joystick (Circle) and it works fine on PC.

    However, I've noticed that in a mobile phone, the Joystick needs a significant finger movement to register a move.

    Is there a way that I can fix this?
     
  46. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    LeanJoystick works using Unity UI's Drag feature. This activates when your mouse/finger moves more than DragThreshold pixels on the current UI element. You can control this from the EventSystem component settings.
     
    pako likes this.
  47. pako

    pako

    Joined:
    Nov 21, 2012
    Posts:
    111
    Thanks, I reduced the DragThreshold and it improved the control.
     
    Darkcoder likes this.
  48. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    343
    I would like to modify LeanSelectionBox.cs to use the right mouse button exclusively. I saw this in the script:

    Code (CSharp):
    1. if (finger.Index == LeanTouch.HOVER_FINGER_INDEX)
    2. {
    3.     return;
    4. }

    I would like to add something similar for right mouse button but syntax is tripping me up. Is there a specific index I can use? I thought it was -2 but LeanTouch is returning -1 for right mouse button.
     
  49. Abhishek_Joshi

    Abhishek_Joshi

    Joined:
    Dec 15, 2019
    Posts:
    2
    Hi @Darkcoder

    I am getting error with Lean Touch

    'LeanSelectable' does not contain a definition for 'OnSelectGlobal'
     

    Attached Files:

  50. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    All mouse buttons are combined together to make the -1 finger press. To detect left/right mouse you must manually check to see which mouse buttons are down if the finger index is -1.


    Did you update between two very different versions of Lean Touch without deleting the old Lean Touch folder first?