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. jma00049

    jma00049

    Joined:
    Feb 21, 2019
    Posts:
    46
    Hello, I cant import Lean to use it via script, the
    Code (CSharp):
    1. using Lean;
    did not work and I need to import it in order to user buttons via script. Any help?
     
  2. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Yes, I describe how to do this HERE.

    You have a LeanAnimationRepater that is starting them automatically?

    Which asset? Lean Touch for example is inside the Lean.Touch namespace. Also, you may have to create an assembly for your code and make that assembly reference the lean one (e.g. LeanTouch). For example, here you can see the LeanTouch asmdef references the LeanCommon one so it can access its code:

    upload_2021-4-5_23-57-47.png

    You can read more about that HERE.
     
  3. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,873
    the leanrepeater is below a leananimation so it shouldn't but it does
     
  4. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    What do you mean? It looks like your "pulsing..." GameObject has the LeanAnimationRepeater component, and that is playing all transitions on the same "pulsing..." GameObject. Based on your settings this means the "pulsing..." transitions will play every 3 seconds without any intervention from you.

    The LeanAnimation component will transition the CanvasGroup.alpha as well as the "pulsing..." transitions.

    It seems like you're misunderstanding how the LeanAnimation components work. The LeanAnimation component is entirely manual and you must call BeginTransitions() on it, but LeanAnimationOnce and LeanAnimationRepeater are automatic and require no calls. Also, these components aren't transitions, so they will be ignored by the transition/animation system. Only components with Transition in the name are used.
     
  5. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,873
    Hello, I'm running into this, would you know what could cause it?
    upload_2021-4-6_9-20-29.png
     
  6. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    What are you doing to cause this?
     
  7. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,873
    invoking this BeginAnimation on this
    upload_2021-4-6_9-49-42.png
     
  8. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,873
    No I understand how LeanAnimation works, what I didn't know is that LeanAnimation* had different startup behavior, due to them sharing prefix.
    Since you're adding them to the core, consider making them ̶i̶n̶h̶e̶r̶i̶t̶ ̶f̶r̶o̶m̶ ̶L̶e̶a̶n̶A̶n̶i̶m̶a̶t̶i̶o̶n̶ ̶a̶n̶d̶ startup the same way. This way, when launched from an event (in this case ultevent) the same method is expected.
     
  9. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,873
    alright it seems that if you put a delay transition at the end it borks the whole thing (i was doing that to pause before it runs the child)
    upload_2021-4-6_11-6-50.png
    the proper is this
    upload_2021-4-6_11-8-16.png
    now i know never to leave a join as last component, maybe add an error catcher for noobs

    and... that was not it, it was the duration = 0 on the setactive
    setting it as 0.01 works, seems that this bug is resilient :)
     
    Last edited: Apr 6, 2021
  10. johnwilkins

    johnwilkins

    Joined:
    Apr 7, 2021
    Posts:
    2
    Hi - sorry if covered elsewhere (have searched and can't find). Is there a function such that moving two fingers up or down tilts the camera on a particular axis? I want to have the same effect as in google maps on mobile, whereby if you move two fingers up or down, it tilts the angle of view. (I also want to use this alongside a rotate function so that if you twist then the 'map' rotates, but I can see that this is there.) Many thanks.
     
  11. Paul-van-der-Laan

    Paul-van-der-Laan

    Joined:
    Oct 12, 2013
    Posts:
    16
    Can you send me a message as well or share the fix publicly? I noticed significant drifting as well with the LeanDragTranslateAlong component in my project but also in the example scene DragUnderAlongPlane you can notice constant drifting (to a minor extend) for some of the objects in the scene. It seems to be linked to the dampening variable, when I set it to 0, there is no drifting (but obviously I can't move the object either anymore).

    For the record, I'm using LeanTouch+ 2.1.7 as I currently don't have access to 2.1.8 from my current place.
     
    Last edited: Apr 8, 2021
  12. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Alright, I'll add some additional settings to LeanAnimationRepeater to make this clearer and more flexibile.


    This looks like a bug, I'll see if I can fix it. Also I'll try and fix the duration = 0 issue again, maybe it only breaks for certain kinds of transitions now.


    The LeanMultiDirection component can be used to do this with the settings Angle = 0, Use / Required Finger Count = 2. You can then connect its OnDelta event to the LeanPitchYaw's RotatePitch function. The Lean/Touch+/Examples/Camera/One Finger Zoom demo scene does something similar for zoom.
     
    laurentlavigne likes this.
  13. cihad_unity

    cihad_unity

    Joined:
    Dec 27, 2019
    Posts:
    30
    Hello,
    I want to use tap and double tap events but I can't seem to find a demo.
    In update history you wrote there was a demo called TapSpawnCount but it was deleted after maybe?

    I need to run a function with single tap, run another with double tap. Please guide me on this.
    While there are plenty of demos for a kickstart, documentation page is very simple and I can't find any information for a specific component.

    Another suggestion: I'd prefer every lean component to have different forum thread. I want to get updates on lean touch but not lean pool or gui.
    Thanks
     
  14. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    I still can't replicate any issues with Duration = 0 transitions.

    parent:
    upload_2021-4-9_19-5-47.png

    child:
    upload_2021-4-9_19-6-5.png

    works exactly as expected. You'll have to modify one of the example scenes and show me a scenario that I can test that replicates this.


    This is shown in the "Lean/Touch+/Examples/03 Finger Tap Expired" and "04 Rotate" demo scenes using the LeanFingerTapExpired component. I recommend you still use LeanFingerTap for the last tap action, so it can trigger instantly, but the first (and other non-last ones) should use LeanFingerTap.

    I plan to improve the demo scene organization soon, as the amount of demo scenes is getting pretty high and some of the demo scene names aren't clear. For information about a specific component you can click the help button on the inspector for it, and look at the bottom list in the documention page to see all components (note that half the components are in the documentation for the Common+ folder).

    I don't plan to split this forum up because the other assets aren't very popular, like 90% of posts here are about LeanTouch.
     

    Attached Files:

  15. cihad_unity

    cihad_unity

    Joined:
    Dec 27, 2019
    Posts:
    30
    Thank you!
    I managed to do that by checking `finger.touchCount` no so difficult but it was important to know :)
     
    Darkcoder likes this.
  16. johnwilkins

    johnwilkins

    Joined:
    Apr 7, 2021
    Posts:
    2
    Thanks. Two follow ups please:
    1) Can there be flexibility so it's not strictly 0, but within a tolerance? In google maps there's a quite a wide tolerance
    2) I can't see anywhere in your documentation or demo scenes how to move the camera based on pinch to zoom. There are loads of examples of scaling components, and I've seen elsewhere about zooming the camera. But how would I translate the camera in the direction it is looking when a user pinches (and the converse)?

    Many thanks
     
  17. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    1 - Angle = 0 means the direction is up-down, and 90 would be left/right, it doesn't mean the angle tolerance. With this component there is no angle tolerance as such, it just gives you the distance the finger travelled in that direction which is technically the dot product between your finger direction and the direction defined by the angle, but you can just think of it as up and down like in any map app.

    2 - This is shown in the Orbit / Zoom / Relative demo scene: upload_2021-4-11_21-33-5.png

    This can be combined with components in other examples to add more features commonly seen in map apps. Basically there are many camera control components, each of these can be configured in multiple ways, and therefore thousands of possible combinations for all of these so I can't make a demo scene for every combination. The demo scenes try to show one feature off at a time so you can later combine them as you like, there are some that combine multiple though, like the Sidescroll 2D / Zoom / Rotate / Map demo scene:
    upload_2021-4-11_21-35-38.png

    This implements a camera system like a typical 2D map app.
     

    Attached Files:

  18. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Hey everyone,

    I made some changes to the way the component and inspector code is structured in all Lean assets, which might break existing projects. Just to be sure, I went ahead and implemented every large code change I was holding off on. Therefore I don't recommend you update these assets if you're in the middle of a project. If you want to try it, you should back up your project files first (or use version control, which you should be already).

    Version 2.2.0 of Lean Touch is now out!
    • NOTE  This is a huge update. Back up your project files before installing.
    • Fixed LeanFingerFilter ignoring manually added fingers that went up.
    • Simplified organization of all demo scenes.
    • Added LeanSelect.Limit setting.
    • The LeanSelect component now stores what it selected.
    • Allowed multiple LeanSelect components to operate at once.
    • Added mouse hover simulated finger.
    • Moved multi finger simulation to new LeanTouchSimulator component.
    • Moved LeanSelect.SearchType to ScreenQuery setting.
    • Moved LeanSelectable.DeselectOnUp to LeanSelect.DeselectWithNothing setting.
    • Renamed LeanSelectable.IsSelected to SelfSelected.
    • Renamed LeanSelectable.OnSelect to OnSelectedFinger.
    • Renamed LeanSelectable.OnDeselect to OnDeselected.
    • Renamed LeanSelect.AutoDeselect to DeselectWithNothing.
    • Added LeanTouch.UseTouch setting.
    • Added LeanTouch.UseHover setting.
    • Added LeanTouch.UseMouse setting.
    • Added LeanTouch.UseSimulator setting.
    • Added LeanSelectable.OnSelected event.
    • Added LeanSelectable.OnFirstSelected event.
    • Added LeanSelectable.OnLastDeselected event.
    • Added LeanSelect.OnNothing event.
    • Renamed LeanSelectable to LeanSelectableByFinger.
    • Renamed LeanSelect to LeanSelectByFinger.
    • Combined 3D, 2D, and UI demo scenes.
    The biggest change with Lean Touch is I rewrote the selection system - the LeanSelect component now stores which objects it selected. This means each object can now be selected by different/multiple select components, and it also means the MaxSelectables setting can now auto deselect the first selected object.

    I also split LeanSelect into LeanSelect and LeanSelectByFinger. LeanSelect is now part of Lean/Common and has no knowledge of touch data, and LeanSelectByFinger does. Simiarly, LeanSelectable is now split into LeanSelectable and LeanSelectableByFinger. These changes make the code much easier to maintain, and they also make the selection system much more flexible. One consequence of this new system is that you can no longer just mark an object as selected as you would before, instead you have to mark it as SelfSelected, or you can drop the object into a LeanSelect/ByFinger component's Select setting to select it. Another nice thing about this system is LeanSelectable no longer needs the DeselectOnUp for press selection, this is now handled by the LeanSelectByFinger.DeselectWithFingers setting, which makes scene setup much easier.

    Another big change is I rewrote how finger data is sent. You can now enable/disable specific types of finger data from the LeanTouch component, including simulated multi fingers. Simulated multi fingers are now sent to LeanTouch using the LeanTouchSimulator component you can add alongside it. This new flexibility allows you to easily 'turn off' all fingers, e.g. if you want to show a tutorial or something and ignore what the user is doing. This new separated simulation system also allows you create your own inputs (e.g. pre-recorded for a tutorial) and send them, and other more advanced tasks. There is also the addition of the mouse hover finger data, though none of the current components use this.


    Version 2.3.0 Lean Touch+ is now out!
    • NOTE  This is a huge update. Back up your project files before installing.
    • Fixed LeanDragTranslateAlong positional drift.
    • Fixed LeanFingerTapQuick adding RectTransform.
    • Added Selection / Select Self / Down demo scene.
    • Improved LeanMultiUp component implementation.
    • Improved LeanDropCount component implementation.
    • Renamed LeanSelectSelf to LeanPickable.

    Version 1.5.0 Lean Localization is now out!
    • NOTE  This is a huge update. Back up your project files before installing.
    • Added auto translation option to LeanPhrase component.
    • Moved languages to separate LeanLanguage component and prefabs.
    • Allowed multiple LeanLocalization instances at once.
    • Changed LeanLocalization.SaveLanguage to only save when manually modified.
    The biggest change with Lean Localization is I rewrote how languages are defined. Previously, you had to fill the language data into the LeanLocalization component itself, but this made it difficult to modify and difficult to use multiple LeanLocalization components with different settings. To fix this, the languages are now defined by prefabs with the LeanLanguage component (the asset comes with the same preset languages as before). To add them you can now just drag and drop them as children of the LeanLocalizaiton component, or drop them into the Prefabs list. This should make it much easier to use! However, it does mean you need to set up your languages from scratch!

    Also, I added Google Translate support to auto translate the LeanPhrase text entries. All you have to do is write at least one translation (e.g. English), and when you create a translation for another language just click the 'modify' button, and select auto translate (see the documentation for more details).


    Version 1.4.0 Lean Pool is now out!
    • Made LeanGameObjectPool auto detach clones when being destroyed (e.g. changing scenes).

    Version 1.2.0 Lean Transition is now out!
    • Added transition builder tool.
    • Added Stop demo scene.
    • Added Skip demo scene.
    • Added Repeat demo scene.
    • Added LeanGameObjectPool.GetClones method.
    • Renamed LeanAnimation component to LeanManualAnimation.
    • Added LeanAnimationRepeater.RemainingCount setting.
    • Removed LeanAnimationOnce component (use LeanAnimationRepeater instead).

    Version 1.2.0 of Lean GUI is now out!
    • Added Non/Interactable events and transitions to LeanButton.
    • Added Non/Interactable events and transitions to LeanDrag.
    • Added Non/Interactable events and transitions to LeanResize.
    • Added Non/Interactable events and transitions to LeanJoystick.

    Let me know if you encounter any issues.

    Enjoy :)
     
    Last edited: Apr 12, 2021
    cihad_unity likes this.
  19. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    4,873
    renaming method is not a good idea, it breaks events
     
  20. Paul-van-der-Laan

    Paul-van-der-Laan

    Joined:
    Oct 12, 2013
    Posts:
    16
    I didn't have time to try the package with the separate fix you sent me but I can confirm the issue is fixed in the latest update, thanks!
     
    Darkcoder likes this.
  21. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    This is a component, not a method. The GUID is the same, and I added an empty LeanAnimation.cs, so it should auto upgrade fine.
     
    laurentlavigne likes this.
  22. pradf4i

    pradf4i

    Joined:
    Nov 7, 2017
    Posts:
    33
    Hi @Darkcoder , is there a way to have different prefabs as a part of the pool and be able to specify them at runtime using Leanpool? Thanks.
     
  23. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Different prefabs inside the same pool? If so, you can change the LeanGameObjectPool component's Prefab setting before/after you spawn. Keep in mind the despawned clones will be spawned in LIFO order, which may be undesirable. You can modify the TrySpawn to randomly pick from the despawnedClones list to possibly improve this.
     
    pradf4i likes this.
  24. cihad_unity

    cihad_unity

    Joined:
    Dec 27, 2019
    Posts:
    30
    Hi @Darkcoder,
    Is there a way to limit leantouch working area?
    e.g. I have a UI panel and I want its children to be draggable only in the panel region, not outside of it.
    Thanks
     
  25. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    For this you should use LeanGUI, which comes with the LeanConstrainToParent and LeanConstrainAnchoredPosition components. If you're moving them with LeanTouch components then they may not work well, in which case you may want to consider using the LeanDrag component from LeanGUI.
     
  26. YevgenG

    YevgenG

    Joined:
    Oct 17, 2018
    Posts:
    20
    Hello @Darkcoder ! I have, maybe, a bit stupid question :) Is it possible to localize texts that are in the config files like these with *LeanLocalization* without using custom code?

    upload_2021-4-19_17-56-1.png
     
  27. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Those look like ScriptableObject assets. LeanLocalization only comes with components to localize other components, so no you would have to write some custom code to do this.
     
    YevgenG likes this.
  28. YevgenG

    YevgenG

    Joined:
    Oct 17, 2018
    Posts:
    20
  29. IceTrooper

    IceTrooper

    Joined:
    Jul 19, 2015
    Posts:
    26
    Maybe it's a simple question, but...
    How to simply check if nothing is selected?
    Scenario:
    1. Take Slingshot example scene
    2. Add horizontal camera moving with LeanFingerUpdate component (OnWorldDelta callback) and custom script (there are more things in script but it's not relevant for this description).
    I just want to move the camera if I didn't press down on the Slingshot object (or any object/GUI on the scene). For now, I got a moving camera, but it's moving even when I started touching slingshot which is not the desired effect of course.

    I got LeanTouch+ and love it, but I'm showing the capabilities of LeanTouch for a wider audience, so I want to make it as simple as possible with the free version (which I think it's possible just don't know how).
     
unityunity