Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

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

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

  1. Qhuhuit

    Qhuhuit

    Joined:
    Feb 17, 2018
    Posts:
    29
    @Darkcoder Thanks for the reply, indeed uncommenting this line fixed the issue.

    I don't understand why it is commented in the first place though? Event changing a slider in the inspector panel makes the camera move. So adjusting the lighting or an object position based on an In-Game specific camera position is almost impossible by default. I'd like to know if you have another point of view :)

    To avoid checking the condition in runtime, I've just wrapped it in a preprocessor directive like this
    Code (CSharp):
    1.      // Is the mouse within the screen?
    2. #if UNITY_EDITOR
    3.     if (new Rect(0, 0, Screen.width, Screen.height).Contains(mousePosition) == true)
    4. #endif
    5.         AddFinger(MOUSE_FINGER_INDEX, mousePosition, 1.0f, mouseSet);
     
  2. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,551
    Some users expect to be able to drag the mouse outside the window and still have it work, and since Unity provides this data in this scenario I provide it by default.
     
  3. pako

    pako

    Joined:
    Nov 21, 2012
    Posts:
    86
     
  4. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,551
    You probably want to use the OnDelta event which gives a Vector2 which is .x and .y for horizontal + vertical. I don't see why you would want to use the world space values. If you had to then you would have to define the horizontal axis e.g. using a Quaternion then you could rotate your Vector3 by this and then the .x and .y could be used, depending on your axis of rotation. It's a little complex to understand I guess, so you should look up quaternion and vector maths.
     
    pako likes this.
  5. pako

    pako

    Joined:
    Nov 21, 2012
    Posts:
    86
    I'll try that, thanks!
     
    Darkcoder likes this.
  6. Veteran66

    Veteran66

    Joined:
    Jul 12, 2015
    Posts:
    34
    hi

    how can i zoom the Camera with Touch Keys
     
  7. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,551
    You can connect a UI button to the LeanPinchCamera component's IncrementZoom or MultiplyZoom methods.
     
  8. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    166
    Hi. I wanted to ask for your advice about UI in my mobile game. I have all the examples including LeanTouch+.

    The controls are simple, two thumbs on the phone in horizontal phone orientation. The right thumb will just be pressing on the screen and off as input. The left thumb I would like to have press on/off and up/down/left/right swipes as input, but only on the left side of the screen. There are no UI buttons just player pressing on the screen. I was wondering if there is a particular example or config that you would recommend I use for this UI.

    Thank You very much for providing this framework.

    Regards...
     
  9. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,551
    Take a look at the Lean GUI asset. This comes with examples of on screen buttons, and joysticks, this should do exactly what you describe :)
     
  10. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    166
    Thank You. I'll check that out...
     
    Darkcoder likes this.
  11. starfoxy

    starfoxy

    Joined:
    Apr 24, 2016
    Posts:
    134
    I am wondering about how Lean Pool would handle the following scenario:

    I spawn a bunch of objects.

    I parent (group) those objects under an existing empty GameObject.

    Do those objects still utilize the performance of the pool or are they somehow disconnected or lost from the pool once I start adding them to existing parent objects?
     
    Last edited: Jun 6, 2021
  12. starfoxy

    starfoxy

    Joined:
    Apr 24, 2016
    Posts:
    134
    I have an unrelated question/issue. For the first time, I decided to use Lean Pool and Lean Transition together. Lean Pool gets installed fine but when I try to import Lean Transition - it won't allow me to import folders like the Examples or Documentation (in the Common folder) as the folder structure is the same as Lean Pool. What should I do here to get both fully installed at the same time?
     
    Last edited: Jun 6, 2021
  13. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    166
    Just a question about Ignore Started Over GUI and Ignore Is Over GUI. The documentation is a bit vague on these I think and maybe they're self explanatory but I would just like to confirm my understanding of these flags.

    So if you take a script like LeanFingerUp for example. If it's added agains a canvas and in the canvas I have a button. If I touch the button and IgnoreStarteOverGUI is selected the LeanFingerUp will not fire, is that correct? If I have the flag cleared then it will? And IsOverGUI would behave the same I guess but while I'm moving the finger over the button?

    What if the LeanFingerUp is against RectTransform and not a canvas? Is there some example or documentation that covers these flags and use cases for them in more detail?
     
  14. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,551
    Pooling only improves the performance of spawning and despawning objects, since they don't have to be fully instantiated/destroyed. What you do with these objects after spawn or before despawn doesn't matter.

    Try deleting the package manager download cache/packages, backing up your project, deleting these assets, and reinstalling them. Older versions of Unity have this stupid package manager bug where it doesn't actually download the latest version. So in your scenario you are probably trying to install an old version of one asset with a new version of another. I changed the folder structure a while back so this difference is important.

    Yes that is correct. The GUI is considered to be any raycastable EventSystem object that is that is on a layer specified by the LeanTouch component's GuiLayers setting, which by default is every Graphic (e.g. Image) inside the Canvas. This can also work for 3D & 2D objects with a PhysicsRaycaster & Physics2DRaycaster. A RectTransform on its own isn't raycastable so no, you would have to at least add an invisible Image to it.
     
  15. starfoxy

    starfoxy

    Joined:
    Apr 24, 2016
    Posts:
    134
    Darkcoder likes this.
  16. Nsingh13

    Nsingh13

    Joined:
    Dec 17, 2014
    Posts:
    30
    Hi! I'm getting errors when importing LeanPool into my project after having imported both LeanTouch+ and LeanGUI. I'm running Unity 2020.2.1f.

    upload_2021-6-10_15-6-40.png
     
  17. Sandro_iXtenda

    Sandro_iXtenda

    Joined:
    May 2, 2019
    Posts:
    3
    Hello everyone,

    I am using Lean Localization and I was wondering if there is a feature to retrieve a translation text for a phrase in a specific language, even when this language is not the selected one. Basically LeanLocalization.GetTranslationText(), but not for the current language, but for a language I can specify.
    I searched the docs, but couldn't find anything. Maybe somebody here has an idea.
     
  18. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    166
    Thank You for the answer :)
     
    Darkcoder likes this.
  19. kypronite

    kypronite

    Joined:
    Apr 15, 2013
    Posts:
    11
    I'm using LeanPool and notice if I spawn 5 projectiles prefab in the scene all at one time,
    I got 5 projectiles spawned
    but when all projectiles are despawned,all 5 projectiles are inactive.
    I don't have performance issue with garbage collection which what I intend.

    But what if I use LeanPool to spawn many different type objects(etc: enemies,projectiles) and all these objects are despawned which mean I have all these inactive object hogging up all the memory.
    I always assume that there's some code under the hood that will clean up inactive object
    if not used for certain duration.
    etc: if fireball projectile are despawned(inactive) and not spawned in one minutes, LeanPool will automatically destroy despawned(inactive) fireball projectile...freeing up memory.

    Or this is by design, the decision to call up clean(ie: destroy despawned clones) is left to the user?
     
  20. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    171
    Hi, recently bought LeanTouch+ and very happy so far. I am stuck with a problem though:
    I want to support gameplay scenarios:
    1. Tile is selected by tap
    2. Tile is zoomed-in by double tap

    I have 1. implemented as it was nicely presented in "Tap to Select" example but I am struggling with 2. Qestion: how to detect Tap or double Tap as exclusive actions. When implementing 1 I used LeanSelectByFinger and LeanSelectableByFinger but this does not seem to be useful for implementing 2.
     
  21. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,551
    You have mismatched versions installed. Delete your package manager download cache, delete the Lean folder, and then reimport to make it work.

    You can get a reference to a LeanPhrase component and access its Entries list, which stores everything. This doesn't work for CSV since that data won't be loaded, and there's no built in methods to access this because it's not a standard use case.


    There's currently no feature like this. Despawned objects don't store any additional data like despawned time, so it would require some modification.


    This can be done using the LeanFIngerTap or LeanFingerTapQuick components. This has the RequiredSelectable component, which can be set to your tile so it only activates when that specific object is selected. So in your case if you set RequiredTapCount = 2, you can use the OnFinger event to trigger your zoom in function (probably would require a custom script of some sort).
     
    kypronite likes this.
  22. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    171
    Thanks, problem is I still don't know how to configure exclusive gestures, meaning receiving 1 tap OR 2 Tap. I added LeanFigerTap 2 times, one is configured with RequiredTapCount to 1 other to 2, problem is the second one is not cancelling the first one (as the work independently) so I am receiving 2 events when performing double tap (1-tap and 2-tap events).
     
  23. khalidfathy

    khalidfathy

    Joined:
    Mar 12, 2018
    Posts:
    4
    Hi,
    I have used Lean Touch+ for Unity 2019.4 and it worked perfectly fine (both 2.1.3 and 2.3.2 versions). However, when I use the same exact setup on Unity 2020.3 the selection scripts just don't work. I can't find what I am doing wrong.
     
  24. Berno

    Berno

    Joined:
    Oct 29, 2014
    Posts:
    36
    Oh right thanks.
     
  25. khalidfathy

    khalidfathy

    Joined:
    Mar 12, 2018
    Posts:
    4
    I have set the Input handling to "Both" as it produced an error when it was by default "New Input System", but it does not work as well.
     
  26. starfoxy

    starfoxy

    Joined:
    Apr 24, 2016
    Posts:
    134
    Has anyone done any comparisons between DoTween (PRO) and Lean Transition? My assumption is that Lean Transition is likely more performant (with less garbage)?
     
  27. tonygiang

    tonygiang

    Joined:
    Jun 13, 2017
    Posts:
    31
    Trade-off between performance and flexibility. DOTween's Tweener and Sequence objects can be reused without allocating more memory, BUT this is not enabled by default. DOTween's defaultAutoKill setting is TRUE and defaultRecyclable is FALSE if you don't specify otherwise. The 4 most frustrating parts of DOTween's way is:
    - Each Tweener has to (re)start at a specific position (default at the current position at the Tweener is created, can be specified), so that means when you (re)start a tweener, your target transform will teleport to the Tweener's start position. Lean Transition's transform move is origin-agnostic unless you tells it to start from a certain point with a 0-second delay transition.
    - For some reason, Tweeners that move targets along a specific axis (MoveX, MoveY, MoveZ) can't be restarted. You have to use DOMove specifying coordinates of all 3 axes to have it restartable.
    - DOTween has no Editor preview like Lean Transition, you have to enter Play mode to see how your tweens look like in action.
    - DOTween's paths can be saved as prefabs to reuse, but due to the lack of target alias like Lean Transition, it's pretty much a 1-to-1 mapping between path prefab and target.
    Use it if you want predefined movements that don't change on demand.

    Use Lean Transition if you want more flexibility.
     
    Last edited: Jun 17, 2021 at 8:34 AM
  28. TeohRIK

    TeohRIK

    Joined:
    Jan 22, 2014
    Posts:
    102
    Hi, I not sure anyone report this before or it just my issue.

    I noticed the LeanLocalization.GetFirstCurrentLanguage() function didn't return anything if the phone default language set to language that not supported.

    Example the app support English and but default phone language is chinese, the function will return empty
     
  29. cwennchen

    cwennchen

    Joined:
    Nov 22, 2019
    Posts:
    6
    Android Device, set Input.multiTouchEnabled=false, will trigger OnFingerUp, how to fix it?
     
  30. starfoxy

    starfoxy

    Joined:
    Apr 24, 2016
    Posts:
    134

    Very insightful and a great help. Thank you kindly @tonygiang !
     
  31. tonygiang

    tonygiang

    Joined:
    Jun 13, 2017
    Posts:
    31
    Hi.
    I'd like to make a feature request for Lean Touch and Lean Transition.

    For Lean Touch: Please provide a version of LeanDragTranslate, LeanTwistRotate (and other classes that may modify an object's transform) that move RigidBody and RigidBody2D via their respective.MovePosition and MoveRotation methods.

    For Lean Transition: Same request for any transition that may modify an object's transform. The Rigidbody and RigidBody2D equivalences of transform transitions would strictly take RigidBody and RigidBody2D as targets.

    These Rigidbody-targeted components would accommodate use cases such as dragging a ball through a group of pins and still have them simulate physics properly as if the ball is being pushed by a natural force. (Yes, if you're thinking this use case sounds like what a god game would need, you're 100% on point)
     
unityunity