Search Unity

  1. 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
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

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

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

  1. tatecreative

    tatecreative

    Joined:
    Apr 24, 2017
    Posts:
    21
    Just read the source of LeanManualRotate and it doesn't look like it supports rotation on Z, which explains the above. Question is, how do I support it using lean+?
     
  2. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,927
    DragTurn2D does rotate on all 3 axes, just like in your example video. If you drag right by 90 degrees then up by 90 degrees then you have just rotated on the Z axis. See the Transform.Rotation values to confirm this.


    Your demo scene doesn't because you have LeanManualRotate.Space set to Self. If you change this to World like in DragTurn2D and your video, then it should behave the same.


    This is because the rotations are done in world/local space based on your finger movements. The camera orientation isn't factored in at all. You could fix this by making your skull a child of your camera. If this isn't suitable for your project then I guess I could add in some kind of setting to rotate the axes based on the camera?
     
  3. White_Wabbit

    White_Wabbit

    Joined:
    Aug 16, 2019
    Posts:
    5
    Hello,
    I used the lean localization. Somehow, on the c# code I can get the current language using
    Code (CSharp):
    1. Lean.Localization.LeanLocalization.CurrentLanguage;
    . But what I want to get is the culture of that current language. How can I get it? Please help.
     
  4. tatecreative

    tatecreative

    Joined:
    Apr 24, 2017
    Posts:
    21
    @Darkcoder Thanks for the speedy reply. Setting the value to world space worked as described, I was following your suggestion in the past post.

    One thing that came up in my last post—drift. Take a look at the video below. In it, I'm putting my cursor on a single spot and rotating it around in a small circle. My expectation is that the object will follow the cursor but not spin around like that.

    Example
    https://www.dropbox.com/s/doa0p6tqf3iqdbr/test4.mov?dl=0

    Example 2
    https://www.dropbox.com/s/jsv6gr0d79o1fqx/test5.mov?dl=0

    In example two, you can see the desired behavior, where the model does not drift yet it still can be rotated on all 3 axis. Example 2 is from another version of the app that I'm building, however, I'm looking at replacing the package I'm using with Lean+, hence all the questions.

    The drift I experience in Example 1 occurs on all axis, even if I only move on a single one. So if I start rotating on X, then go in reverse, the object starts to drift a bit. I adjusted the multiplier and dampening, 1 and -1, which slows the movement down but it does not improve the drifting. I also adjusted the multiplier on the LeanMultiSet, setting it to 100, which helped a bit but not without the cost of slowing down the gesture.

    Thanks!
     
    Last edited: Jan 29, 2020
  5. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,927
    You can get a list of LeanLanguage instances from LeanLocalization.CurrentLanguages (static), or .Languages (instance). Find the one you want from this list, then you can access the Cultures list from that LeanLanguage instance.



    This is a consequence of how the rotation works, where it's continuously applied based on your finger delta. Imagine one frame you move mostly on the X axis, then next frame mostly on the Y, because of your prior rotation you will now be rotating around the Z axis slightly, and so on. Eliminating this drift would require a new rotation component that stores the original rotation before you touch the screen, and while touching the screen it constantly re-calculates the final rotation based on the initial rotation + your finger delta. I'll see what I can do.
     
  6. tonygiang

    tonygiang

    Joined:
    Jun 13, 2017
    Posts:
    7
    Hi, how do I setup a transition transform so that I can achieve this sequence?
    Transition 1 plays
    JoinDelay 1 second
    Transition 2a and 2b play at the same time
    JoinDelay 1 second
    Transition 3 plays
    Right now, if I attach a JoinDelay, Transition 2a and Transition 2b in that order, only Transition 2a will be delayed by JoinDelay whereas Transition 2b always play immediately.

    The same thing happens when I group Transition 2a and 2b into a separate transition transform and attach an InsertTransition after the JoinDelay.

    Same thing also happens when I attach a JoinInsertTransition with a separate transition transform.

    I even tried connecting Transition 2a and 2b with a negative-value JoinDelay and that also didn't work.
     
    Last edited: Jan 30, 2020
  7. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,927
    Did you try nesting your transitions as seen in the Branches demo scene?

    This allows you to begin multiple transitions as soon as the last transition on the parent finishes. You can then nest another 'Transition 3' under them.

    It's possible to do this without nesting using Queue Transition, and then dragging and dropping the Transition 1 into the Target, but it can get a bit hard to see what's going on, so I recommend nesting.
     
  8. tonygiang

    tonygiang

    Joined:
    Jun 13, 2017
    Posts:
    7
    Thanks, the nesting method works, but with a BIG caveat.

    A setup like this will work:
    Parent:
    Transition 1
    JoinDelay 1 second
    Child 1:
    Transition 2a
    Child 2:
    Transition 2b
    But a setup like this will not work:
    Parent:
    Transition 1
    JoinDelay 1 second
    Child 1:
    Transition 2a
    Transition 2b
    Anyway, since the idea came up during experimentation, will you support negative-value JoinDelay to support the use case of triggering a transition just a moment before the previous transition finishes?
     
  9. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,927


    Nested transitions work by inserting a QueueTransition before each child, and linking that to the parent's last transition. I can see how this behaviour is unintuitive though, and making it so all unconnected transitions connect to the parent would make more sense. The attached package makes it so any non-joined transitions will automatically connect to the parent's last transition, thus allowing both of your scenarios to work.

    I can see how a negative delay would be useful. Try the attached package ;) I also allowed this to be used with nested transitions, so you can begin a child with JoinDelayTransition -0.5 or something.

    Let me know if you encounter any issues!
     

    Attached Files:

    Last edited: Jan 30, 2020
  10. tonygiang

    tonygiang

    Joined:
    Jun 13, 2017
    Posts:
    7
    The attached package appears to work for both functionalities.

    Have you considered converting your free Asset Store packages to UPM packages and publishing them to OpenUPM?
     
  11. tatecreative

    tatecreative

    Joined:
    Apr 24, 2017
    Posts:
    21
    Thanks for the explanation! Makes sense. Is this something you have in your current pipeline?

    I was also working on using the select methods, which demo would be the best to look at for “on touch, select and affect, on touch anything else then automatically deselect”? I took a look at the examples and implemented what I understood but it requires that I double click on the object to select it and deselect. Is that just a mouse pointer thing?
     
  12. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,927
    Great!

    I have no plans to upload my assets anywhere besides the Asset Store.


    Try the attached component, just add it to your skull GameObject and it should work.


    You can set the LeanSelect.MaxSelectables setting to 1 to achieve this.
     

    Attached Files:

  13. tatecreative

    tatecreative

    Joined:
    Apr 24, 2017
    Posts:
    21
    Amazing, thank you!
    Re the selectables, what if I have other components that I want to use lean+ on? Like another object that has a rotate?
     
  14. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,927
    If you set MaxSelectables to 1 then you can only select one object at a time. There's no limit to how many components you can attach to a LeanSelectable though, so you can have one object only move, one object only rotate, some combination, etc. You can also have multiple LeanSelect components with different settings, and somehow isolate them if you need more complex selection behavior.
     
  15. camel82106

    camel82106

    Joined:
    Jul 2, 2013
    Posts:
    306
    Hi,
    I'm old user of EasyTouch. But as it is starting to be obsolete. I'm looking on new assets.

    Your LeanTouch looks pretty promising.

    I'm curious if it's possible to implement easily an drag & drop feature which will drag the nearest selectable object only.

    Imagine situation where you have two selectable objects with overlapping raycast areas. Than I would like to select and drag only the nearest one. Is it possible to modify it like this? (Unity UI)

    Thanks
    Peter
     
  16. tatecreative

    tatecreative

    Joined:
    Apr 24, 2017
    Posts:
    21
    @Darkcoder Thanks for the script! Couple of things:
     
    Last edited: Feb 1, 2020
  17. ArcherSS

    ArcherSS

    Joined:
    Apr 7, 2018
    Posts:
    16
    Hi, does LeanTouch+ support "Configurable Enter Play Mode" feature. I found the LeanFingerHeld cannot work when I disable domain and scene reloading. Is that expected or do I miss something?
     
  18. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,927
    Good idea, this isn't possible currently though. I'll see what I can do next week!


    Try the attached updated script, this should allow other components to influence the rotation too. You can set the multiplier values to whatever you find works best.

    LeanPinchScale uses the actual scale your fingers make when pinching or expanding. I guess I could add some kind of multiplier to this though. The scale can be clamped using the LeanConstrainScale component from LeanTouch+.

    If I modify the Select3D scene to have MaxSelectables = 1, then I can select or deselect with one click as expect. Not sure what your scene setup is like to make this different?


    I haven't tried this feature yet. Which exact version of Unity did you try it with?
     

    Attached Files:

  19. tatecreative

    tatecreative

    Joined:
    Apr 24, 2017
    Posts:
    21
    @Darkcoder Thank you, that definitely helped.
     
  20. tonygiang

    tonygiang

    Joined:
    Jun 13, 2017
    Posts:
    7
    Hi, do you plan to support transitions for Renderer's material properties? I mainly just want the material.color transition because the SpriteRenderer.color transition is limited to SpriteRenderer component and doesn't work for materials that ignore sprite renderer's color property.
     
  21. ArcherSS

    ArcherSS

    Joined:
    Apr 7, 2018
    Posts:
    16
    Hi, I'm using Unity 2019.3.0f3. This feature makes entering play mode super fast, I think I will have it enable by default, so I hope LeanTouch+ can work under this feature. Thanks!
     
  22. tatecreative

    tatecreative

    Joined:
    Apr 24, 2017
    Posts:
    21
    @Darkcoder I think I figured out the floating issue. I thought it had to do with my collider and incorrect physics being applied via velocity or something like that. I'm not sure what the root cause is but the fix was removing all Lean components from my model and adding them back again. Thoughts?
     
  23. alex_roboto

    alex_roboto

    Joined:
    Nov 11, 2019
    Posts:
    11
    @Darkcoder
    1. LeanLocalization is missing a component compatible with TextMeshProUGUI. LeanLocalizedTextMesh has a comment saying it works with TextMeshProUGUI but it doesn't. (Copying the code in LeanLocalizedTextMesh into a new component called LeanLocalizedTextMeshProUGUI and replacing "TextMesh" with "TMPro.TextMeshProUGUI" works fine.)
    2. LeanLocalization's LeanLanguageCSV's "Export" functionality could export to the same TextAsset it loaded from so Export won't keep re-prompting where to export to:
    Code (CSharp):
    1.         [ContextMenu("Export Text Asset")]
    2.         public void ExportTextAsset()
    3.         {
    4.             if (string.IsNullOrEmpty(Language) == false)
    5.             {
    6.                 // Find where we want to save the file
    7.                 string path = null;
    8.                 if (Source != null)
    9.                 {
    10.                     path = AssetDatabase.GetAssetPath(Source);
    11.                 }
    12.                 else
    13.                 {
    14.                     path = EditorUtility.SaveFilePanelInProject("Export Text Asset for " + Language, Language, "txt", "");
    15.                 }
    Thanks for creating LeanLocalization!
     
  24. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,927
    Good idea, try the attached package. The new Material color Transition component can do this. I'll submit this new build soon after I finish a few other things.



    Interesting, perhaps the order of the components (execution order) was the issue.


    1 - You must double click the Lean/Localization/TestMeshPro package to add support for it.

    2 - Could do, when I designed this feature I imagined people would only export once and from then on manually add to the CSV rather than create translations in the editor and keep exporting them.
     

    Attached Files:

    alex_roboto likes this.
  25. tatecreative

    tatecreative

    Joined:
    Apr 24, 2017
    Posts:
    21
    @Darkcoder is it possible to use Drag Translate with an object that has Twist Rotate, Pinch Scale, and our new Drag Rotate on it without having the translate affect any of the other values?
     
  26. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,927
    I made a mistake with the last version, try this one.
     

    Attached Files:

  27. tonygiang

    tonygiang

    Joined:
    Jun 13, 2017
    Posts:
    7
    Thanks. This is great!
     
    Darkcoder likes this.
  28. tatecreative

    tatecreative

    Joined:
    Apr 24, 2017
    Posts:
    21
    Updated the script, this is the result: https://www.dropbox.com/s/nfas5jilxc5rcoc/test8.mov?dl=0
    • The model still rotates on movement
    • I have Twist Rotate, Pinch Scale, Constraint Scale, Drag Rotate, and Selectable on the model
    • I set Drag Translate Required Mouse Buttons to 3 in order to simulate a 2 finger drag
    • Everything works as expected if I disable the Drag Rotate
    Thank you for all your help with this!
     
  29. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,927
    I notice no issues when using RequiredFingerCount to isolate each gesture to prevent conflicts (see screenshot).

    RequiredMouseButton is just used in addition to RequiredFingerCount to allow more complex controls on desktop.
     

    Attached Files:

  30. fearlesshyena

    fearlesshyena

    Joined:
    Apr 19, 2014
    Posts:
    4
    Hi @Darkcoder I purchased Lean Touch+ a little while back and am currently trying to use it for a project
    I'm basically trying to use the LeanDragTrail script to draw on a 3D Object but having a bit of trouble making it work accurately
    I want the drawing to only register on certain layers so I used the Unity default 3D with Extras URP Project and tried it with the Physics Raycast option in the script
    I then registered only the Environment layer (which currently only contains the Ground and the Drywall) in the Layers section
    The drawing seems to register but the trail seems to be jagged and sometimes I get randomly generated lines. Should I be using a different option (like Plane Intercept?)
    Here's a screenshot of how it looks
    Would you have any suggestions/pointers or maybe an example project on how to do this? Would greatly appreciate any help! Thanks :)

    LeanTouch_Draw.png
     
  31. tatecreative

    tatecreative

    Joined:
    Apr 24, 2017
    Posts:
    21
    That did it, thanks @Darkcoder
    I have another question, different issue.
    • My scene has 2 cameras—main and secondary
    • The main camera covers the entire screen
    • The secondary is positioned in the lower right hand side
    • The secondary camera is set to Ortho, has layers configured so it only renders relevant layers, and contains a 3D object that also has LeanDragRotate and LeanSelectable
    • I'm using FingerDown on my LeanSelect element as shown here: https://www.dropbox.com/s/95snkifs7kd9px4/Screenshot 2020-02-11 00.14.54.png?dl=0
    • I can select/deselect the object rendered by the Main camera easily
    • However, I'm can't select the object rendered by the Secondary camera unless I set Is Selected to True on the object
    • If Is Selected = true, then it's selected and I cant move it in isolation
    • Once I start moving the main object rendered by Main Camera, the object rendered by Secondary camera starts moving too
    • I'd like to be able to independently select either item rendered by either camera, without having to make any special gestures or require multiple fingers for a specific object. Start dragging the main object, release, rotate the 2nd object, release, scale the main obj and release, etc
    Do I need to set some sort of condition that uses Tap to say "If you've tapped on the secondary camera then set the obj Is Selected to True and deselect the object from the main camera"?
     
  32. tatecreative

    tatecreative

    Joined:
    Apr 24, 2017
    Posts:
    21
    @Darkcoder I kinda found a solution but it's probably not the best. I duplicated my LeanSelect component and set each component's camera value. https://www.dropbox.com/s/syc7je69br7erux/Screenshot 2020-02-11 00.41.22.png?dl=0

    I get the following console warning:
    Your scene already contains a LeanManualSelect component, using more than once at once may cause selection issues
    UnityEngine.Debug:LogWarning(Object, Object)
    Lean.Touch.LeanSelect:OnEnable() (at Assets/Lean/Touch/Examples/Scripts/LeanSelect.cs:319)


    Although it produces the desired result. Any recommendations on how to go about this the right way?

    Thanks
     
  33. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,927
    This is what happens when you draw thick lines with rapid changes in position across all 3 axes, because there's only so many ways you can rotate each segment to form a line that looks good. You could try changing the LineRenderer.Alignment to Local, but you really need to use a thinner line to reduce this issue.


    This warning is mostly so users don't just copy+paste two different selection components together and wonder why it doesn't work as expected. If you have the cameras isolated then it should work. Just keep in mind there is no concept of which camera or LeanSelect actually caused an object to be selected, so there's no built in way to isolate controls across both (you would have to manually do this). Such a feature would make the code much more complex, and require the introduction of a few more settings on each component, and I don't imagine 99% of users would ever need this, so it doesn't seem worth it. You can always modify LeanSelect and LeanSelectable to store this additional data depending on your project specific needs.
     
  34. fearlesshyena

    fearlesshyena

    Joined:
    Apr 19, 2014
    Posts:
    4
    Thanks a bunch for the suggestion. I'll try using a thinner line and see how that works out
     
    Darkcoder likes this.
  35. alex_roboto

    alex_roboto

    Joined:
    Nov 11, 2019
    Posts:
    11
    @Darkcoder Here is a simple script that automatically updates the translations when a translation CSV file changes. Our UI artist asked for this to speed up her development cycle and checking and fixing strings. I share it here in case anyone else needs this functionality:

    Code (CSharp):
    1. using UnityEditor;
    2.  
    3. namespace Lean.Localization
    4. {
    5.     class LeanLanguageCSVPostProcessor : AssetPostprocessor
    6.     {
    7.         static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    8.         {
    9.             foreach (string assetPath in importedAssets)
    10.             {
    11.                 var source = LeanSource.Instances.First;
    12.                 for (var i = LeanSource.Instances.Count - 1; i >= 0; i--)
    13.                 {
    14.                     LeanLanguageCSV leanLanguageCSV = source.Value as LeanLanguageCSV;
    15.                     if (leanLanguageCSV != null && AssetDatabase.GetAssetPath(leanLanguageCSV.Source) == assetPath)
    16.                     {
    17.                         leanLanguageCSV.LoadFromSource();
    18.                     }
    19.                     source = source.Next;
    20.                 }
    21.             }
    22.         }
    23.     }
    24. }
    25.  
    Simply put the file in an Editor folder and it works automatically. Thanks for sharing LeanLocalization with the community!
     
    Last edited: Feb 14, 2020
  36. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,927
    Interesting idea, testing if text fits isn't something I considered during the design of this asset. However, in this scenario I think it's much easier to just type into the Text component itself and modify the text or font settings as needed, then finally copy+pasting into the CSV. Lean Localization only updates the text on startup or when changing language, so you're free to modify the text between these times.
     
  37. unadamlar

    unadamlar

    Joined:
    Jul 7, 2015
    Posts:
    10
    Lean Localization has so many SetDirty calls that seemingly do nothing. At least in git the scene file shows no change but still the scene save indicator always appears. Is this an intended feature? Is it possible to remove these SetDirty calls?
     
  38. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,927
    It's possible I added a few too many. In which scenario do these cause the scene to become unnecessarily dirty?
     
  39. amjadyahya1

    amjadyahya1

    Joined:
    Aug 5, 2016
    Posts:
    15
    I get this error:
    InvalidOperationException: EnsureRunningOnMainThread can only be called from the main thread
    When I use LeanPool.

    Environment:
    MacOS Mojave, Unity 2019.3.1f1
     
  40. msummers

    msummers

    Joined:
    Dec 23, 2016
    Posts:
    3
    Hello I'm Having a problem with LeanPool in Unity 2019.3.2f1

    I'm using the spawn method.

    Code (CSharp):
    1. var newMenuItem = LeanPool.Spawn(menuItemPrefab, menuTransform);
    And then removing the items from their parent transform in a loop

    Code (CSharp):
    1. foreach (Transform child in menuTransform) {
    2.        LeanPool.Despawn(child.gameObject);
    3. }
    The behavior I am getting is that not all of the items are being de-spawned properly. All of the items in the parent were spawned with LeanPool.spawn. If I delete them manually it logs a warning to the console as expected.

    Calling LeanPool.DespawnAll(); works but has the side effect of deleting everything.

    Any thoughts on why only some of the items are being removed and returned to the pool?
     
    Last edited: Mar 1, 2020
  41. msummers

    msummers

    Joined:
    Dec 23, 2016
    Posts:
    3
    Reverse looping over the child transforms seems to work

    Code (CSharp):
    1. int childCount = menuTransform.childCount;
    2.         for (int i = childCount-1; i >= 0; i--) {
    3.             LeanPool.Despawn(menuTransform.GetChild(i).gameObject);
    4.         }
    But foreach doesn't work. Prior to adding pooling the foreach was working fine for destroying objects directly.
     
  42. msummers

    msummers

    Joined:
    Dec 23, 2016
    Posts:
    3
    I've likely answered my own question but just following up here to help out the next person. So, it would appear that objects killed off with GameObject.Destroy() are not fully removed until after the current update loop completes. Which is why the foreach loop works.

    Where as LeanPool.Despawn isn't destroying the objects, so they are removed from the parent pretty much instantly. This results in the transform parents number of children being reduced by one every loop.

    The reverse for loop works because it is basically just removing the current last child every loop. Any strong opinions on the best way to loop over and despawn the children of a transfrom?
     
  43. leavers251

    leavers251

    Joined:
    Jul 5, 2019
    Posts:
    1
    Hi! Thank you for your great assets. I am currently using Lean pool, Awesome stuff!

    I am currently trying to spawn my gameobjects on random position offscreen, but i stuck in making random position spawn.

    Making random position coordinates is not different, the spawn code cannot accept the position.

    If you have some suggestions, i will be very grateful!

    Thank you!
     
  44. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,927
    From which line of code? If it's from your own code running in a separate thread then that part of the code must be executed on the main thread.


    Indeed, the foreach collection in your example is being modified as you iterate through it, giving you unexpected behaviour. Is there any problem with your current solution of reverse looping? I often using this pattern to avoid issues like this.


    LeanPool.Spawn has an overload that accepts a position (just like Instantiate), so it should work fine:

    public static T Spawn<T>(T prefab, Vector3 position, Quaternion rotation, Transform parent = null, bool worldPositionStays = true)
     
  45. maulikhack

    maulikhack

    Joined:
    Oct 3, 2018
    Posts:
    9
    Hi, I bought this asset and after importing I found out that it does not work in runtime :( I was looking to make custom polygon shape images in runtime and this asset has the option to edit points only in the editor. can you help me out?/ am I missing something?


    Code (CSharp):
    1.  
    2. private LeanPolygon leanpolygon;
    3.  
    4.     private void OnEnable()
    5.     {
    6.         if (!leanpolygon) { leanpolygon = GetComponent<LeanPolygon>(); }
    7.         leanpolygon.Points;
    8.     }
     
    Last edited: Mar 2, 2020
  46. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,927
    The LeanPolygon component gives you the Points list, as your code is accessing. You can then add or remove points from this list as you wish, just like with any other list. For example:

    Code (CSharp):
    1. var points = yourPolygon.Points;
    2.  
    3. points.Clear();
    4. points.Add(new Vector2(0, 0));
    5. points.Add(new Vector2(1, 0));
    6. points.Add(new Vector2(0, 3));
    7.  
    8. yourPolygon.SetVerticesDirty();
    I should mention it in the documentation, but you must also call the SetVerticesDirty method to let LeanPolygon know you changed the points.
     
    maulikhack likes this.
  47. maulikhack

    maulikhack

    Joined:
    Oct 3, 2018
    Posts:
    9
    Thanks :)
     
    Darkcoder likes this.
  48. g-augview

    g-augview

    Joined:
    Mar 28, 2017
    Posts:
    9
    hi, I am having an issue with LeanTouch: I can't make it to ignore touches (finger.touchOverGui set to true) on buttons when using a world space canvas. Other elements in my world space canvas work as expected but not the buttons. Any idea what is causing this (I made sure to add my button's layer in the GUI layers and also tried to change layers)?
    thanks
     
  49. maevin

    maevin

    Joined:
    Dec 3, 2010
    Posts:
    33
    Hello community,

    I have been using unity for a short period of time, I grasp most of the concepts, yet I have an issue that I have spent over 20 hours on and can't quite figure it out.

    I am working with the Lean UI from the asset store, I am working with scene 4... Modals.

    The only difference from the basic scene which is a button that opens a modal. I copied that button so now I have 2 buttons. However, when I open the first button, the 2nd button stays in the background and unable to select. this is expected, however, when I click the second button, the second button shows over top of the modal and the first button rests behind the modal as expected.

    How do I get the 2nd button to appear behind the modal?

    here is the link to the item

    https://assetstore.unity.com/packages/tools/gui/lean-gui-72138#content

    I have also uploaded the scene that I have edited.
     

    Attached Files:

  50. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,927
    If I switch the example Canvas to world space then it blocks touches as expected. Does your canvas have a Graphic Raycaster?

    Aha, I received your email, but gmail was unable to send my reply to you, here it is:

    The main issue with your scene is that you placed the modal window as a child of the button.
    Buttons will automatically 'use' any UI elements that are children of it, including your modal window, which isn't what you want.
    If you want to group them then make an empty GameObject and put both your button and modal window as children of it, so they don't interfere.

    Also, when you group UI elements like this, make sure the parent is set to Anchors Min = 0, Max = 1, with Left/Right/Top/Bottom = 0, otherwise you will mess with the positioning of the children.
    Also, your button is anchored to the center, and manually positioned to the top using PosY, this doesn't work with different aspect ratios (try landscape). To fix this you should set the Y anchors to 1 and PosY to something negative.
     
unityunity