Search Unity

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

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

  1. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,484
    Feel free to ask any of your questions here!
     
    Last edited: Aug 1, 2019
  2. dariuspranskus

    dariuspranskus

    Joined:
    Jul 6, 2019
    Posts:
    1
    Hello, I am pretty new to Unity. What I want to achieve is to initiate a rotation of a small object by swiping in clockwise or counter-clockwise manner with a single finger. Is it possible to detect with the library? Which example can I use to get some advice from? Could you please advice. I just recently purchased the Lean Touch+. Thanks
     
  3. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,484
    There's no component or demo scene that can detect this yet, but this sounds like a good idea so I can add it. I'll send you a build when it's implemented!
     
    rexcheung likes this.
  4. giggioz

    giggioz

    Joined:
    May 11, 2017
    Posts:
    18
    Hi Darkcoder,

    I was looking at LeanTouch/LeanTouch+: do they manage gesture recognition?

    If the answer is yes, here you can find more detail about my needs:

    Basically, in my game, I want to allow the player to trace magic symbols on the screen and this will trigger some internal mechanics.

    Is it possible to create some particles effects and trails during the player gestures to improve the visual quality of the action?
     
  5. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,484
    The next version of LeanTouch+ will include drawn shape recognition :)

    You can already add trails to fingers using LeanFingerTrail/Fade, but not particles. I'll add that too!
     
  6. rexcheung

    rexcheung

    Joined:
    Feb 2, 2017
    Posts:
    26
    Hi Sir,
    I am looking for this function too.
    I guess the idea is to attach three conductive points to form a fixed triangle so that unity can detect and locate the triangle movement.
     
  7. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,484
    Seems everyone wants this :D

    Good news is that I've just finished implementing this feature, I'm just working on making the demo scenes for it now. I'll submit a new version and send everyone early builds later today.
     
  8. rexcheung

    rexcheung

    Joined:
    Feb 2, 2017
    Posts:
    26
    you are so great, i just brought Lean touch + and wait for your great demo :)
     
    Darkcoder likes this.
  9. Tom-Goethals

    Tom-Goethals

    Joined:
    Mar 6, 2015
    Posts:
    81
    LeanTouch works great! Thanks for the Asset!

    I want to run 2 windows touchscreens at the same time from 1 PC. (only have 1 at the moment to test myself)
    Would I be able to differentiate between touches coming from either screen?
    for example, the left screen rendering camera 1 is controlling camera 1 by touch and the same for the right screen with camera 2.

    Can you share any experience with running touch in windows on multiple screens?

    Thanks!
    Tom
     
  10. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,484
    I don't have access to any dual touch screen setups, so I have no idea. Unity's Touch class doesn't appear to contain any information about screens though, so assuming it does support such setups, there's no automatic way to detect which screen it's on. You would probably have to calculate this yourself.
     
    Tom-Goethals likes this.
  11. mcbridecs

    mcbridecs

    Joined:
    Feb 7, 2017
    Posts:
    2
    Carlos,

    Our team is referencing an English.txt csv file in LeanLocalization. We are using the Lean Localized Text Phrase Path variable on each of our text objects and the text display red even though the connection is working. Also, when we update to the latest version and import the csv, it does not fill in the Phrase Path variable. Without having to reselect each text box, how should we proceed?

    Also, Is there a way to update the CSV file after build if we wanted to be able to change the text on the fly from the CSV?
     
    Last edited: Aug 8, 2019
  12. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,484
    I made a mistake with LeanLocalizedBehaviour.cs, change like 26 to: [FormerlySerializedAs("PhraseName")]

    Your behaviours should now carry over after your upgrade. If the old version works fine then you could just stick with that, since I did change quite a lot recently.

    Modifying text from a CSV isn't a scenario I considered when designing Lean Localization. One thing you could do is change the LeanLanguageCSV script execution order to be -100 or something, then you could create a normal LeanPhrase with a GameObject name matching the phrase you want to override, then you can add a translation Entry for the desired language.
     
  13. GordonWedge

    GordonWedge

    Joined:
    Jul 6, 2013
    Posts:
    17
    Hi, thanks for your great assets.
    I'm working with lt+ and wanna get pinch data and direction, i've added a leanmultipinch script to my gameobject on scene, and added a function to onpinch event, buy i don't understand how to get pinch data.

    Schermata 2019-08-14 alle 11.05.53.png

    Code (CSharp):
    1.     public void onpinch(Lean.Touch.LeanMultiPinch myData)
    2.     {
    3.         Debug.Log(myData.????);
    4.     }
     
  14. nigel-moore

    nigel-moore

    Joined:
    Aug 28, 2012
    Posts:
    22
    Hey DarkCoder,

    Just running through and example project I found that uses LeanTouch - I updated the asset in the project to the latest version and now its complaining with these error messages:

    Assets/Scripts/ARImageScene.cs(228,17): error CS0200: Property or indexer 'LeanSelectable.OnSelectUp' cannot be assigned to -- it is read only


    this is the bit of code in question:

    var leanSelectable = imageObject.GetComponent<LeanSelectable>();


    if (leanSelectable != null)
    {
    // intialize events ( only needed when LeanSelectable is added via code - currently not the case )
    if (leanSelectable.OnSelectUp == null)
    {
    leanSelectable.OnSelectUp = new LeanSelectable.LeanFingerEvent();
    leanSelectable.OnDeselect = new UnityEngine.Events.UnityEvent();
    }

    // image OnSelectUp event instead of OnSelect to include Tab information
    leanSelectable.OnSelectUp.AddListener(ImageSelectUp);
    leanSelectable.OnDeselect.AddListener(ImageDeselect);
    }


    Obviously these properties used to have setters as well as getters but I was wondering if you had any suggestions for a fix?
     
  15. Sir_Ken

    Sir_Ken

    Joined:
    Aug 23, 2014
    Posts:
    3
    Hi,

    Thank you for the Lean series, they are great!

    I have been working with the LeanDrag in Lean GUI recently. Is there a functionality to constrain/clamp the drag surface to the parent object instead of entering floating numbers?
     
  16. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,484
    The OnPinch event you can see in the event inspector gives you one parameter (Single), this is another name for float. The actual value of this depends on your Scale setting, which is currently Pinch Scale. If there is no scale then this will be 1.0, but if you get a value of say 0.9, then that means between the previous and current frame, you pinched to 90% of the previous scale (e.g. if your fingers were 100pixels apart, then they are now 90). If your fingers expanded then this would be above 1.0.


    You can remove the code that checks to see if leanSelectable.OnSelectUp is null, and the code inside that gives it a new instance.

    This code used to be required because the events were public fields, but I've now made them private and given them properties that automatically initialize to non-null when accessed for the first time. This should require less code now and allow users to develop faster. Unfortunately you will have to remove this old code though!


    Not currently, but that sounds like a great idea. I can try adding it next week!
     
  17. oneuppedgames

    oneuppedgames

    Joined:
    Jul 30, 2013
    Posts:
    15
    Hi! Thank you for your great assets. I am currently using Lean Localization, and it's been a blast to work with. Awesome stuff!

    I am currently trying to get Tokens to work, but I can't seem to get it to work. My current setup is:

    - I'm using a CSV with a tag / name and a translation including a token (i.e. token.test.translation = this is the token: {NAMEOFTOKEN}
    - I created a token (created using the 'Add' button in the LeanLocalization Inspector) called 'NAMEOFTOKEN'
    - This generated a GameObject (and reference to this GameObject in the Lean Localization Inspector) called NAMEOFTOKEN and I added a value (ThisIsTheTokenValue)
    - I call the translation in code using: LeanLocalization.GetTranslationText("token.test.translation");

    I keep getting 'this is the token: {NAMEOFTOKEN}' as a translation result, instead of 'this is the token: ThisIsTheTokenValue'.

    I've checked the documentation and I am doing exactly as suggested. I also looked into your examples, but there is no token example it seems? I've also tried using a similar setup without CSV and such, but I keep getting the same unwanted result.

    Any idea?

    Also: do you have a way so I can donate some bucks? Your tools have helped me out quite a bit, and I'd like to return the favour. Cheers!
     
  18. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,484
    Thanks for pointing this out. GetTranslationText currently just returns the raw text without any token substitution, I'll have to update the code to do this, and now that you point it out I also notice a bug with the substitution code that would cause it to break if you tried to use it in your current scenario. I'll send you an updated build in a little bit.

    I have no donation system setup. The best way to support me is to write a review (or at least a rating) if you haven't already. If you really want to give me money then you could always purchase one of my assets if they will help your project :)
     
  19. Fluffy_llama7

    Fluffy_llama7

    Joined:
    Oct 2, 2018
    Posts:
    1
    I'm a beginner game developer, (so forgive me if I'm missing something obvious), and I wanted to make a mobile game, so I found this asset. It works very well and is easy to use, especially considering how I don't have much experience in game design, but there is one thing that I'm not sure if I can do with this.

    I have an object, which is an iceberg, that I want the player to be able to tilt by dragging a finger without necessarily swiping, so that the player does not have to lift their finger off of the screen. As the player drags their finger up or down, the iceberg tilts away and towards the player, and as the player drags their finger left and right, the iceberg tilts to the left or to the right. In essence, it will tilt in the direction that the player drags their finger and it will tilt more or less depending on the distance that the player drags their finger.

    The closest thing that I found was the feature that could detect the angle and distance of a swipe. Please let me know if I can achieve what I described with this asset.

    Thanks for this amazing asset! I'm definitely going to use it in more games in the future.
     
  20. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,484
    LeanTouch+ includes the LeanManualRotate/Smooth component (DragTurn2D demo scene), which can be used to do this. With this component you can rotate an object (e.g. iceberg) along two axes of rotation using a finger drag gesture.
     
  21. kayy

    kayy

    Joined:
    Jul 26, 2011
    Posts:
    52
    First of all thanks for this amazing asset, just the bought the plus to support you :)

    I stumbled upon some static actions in LeanTouch.cs, that JetBrains Rider (or Resharper) marks as dangerous:
    Code (CSharp):
    1. public static System.Action<LeanFinger> OnFingerUp;
    2. // several samples (e.g. LeanFingerHeld.cs) us in code like
    3. LeanTouch.OnFingerUp   -= OnFingerUp;
    The -= for unsubscribing is marked with a hint Delegate subtraction has unpredictable result. You can find a detailed explanation at JetBrains help page.
    I think OnFingerUp should be rather declared as an event e.g. public static event System.Action... so that listeners can safely subscribe and unsubscribe no matter how many listeners exist.
    But maybe I am wrong and this is intended. In that case we should register/unregister our one and only listener by assignment like
    Code (CSharp):
    1.  LeanTouch.OnFingerUp = OnFingerUp;
    2. // and unregister
    3. LeanTouch.OnFingerUp = null;
     
  22. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    1,484
    I'll consider changing them to events. I think this warning is silly in this scenario though, because -= OnFingerUp; is just unsubscribing a method, so there is no scenario where this will cause the behaviour described on that page. They should really improve their parsing skills to test to see if the user is adding multiple methods together like this before warning of this.