Search Unity

  1. How can our website serve you better? Give us your feedback. Take our survey and let us know.
    Dismiss Notice

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:
    2,586
    You can't do this with LeanSelectableDial directly, but this component has the OnAngleChanged event, which can be sent to LeanThresholdPosition, which can then send the position (angle) every 'n' degrees, which can be sent to LeanPitchYaw or similar.


    LeanSelect has the SelectUsing, SelectUsingAlt, and SelectUsingAltAlt settings, which can be used to select 3 types of objects in the specified order/priority. This is shown in LeanTouch+ in the "Lean/Touch+/Examples/Selection/02 Select 2D+3D+UI.unity" demo scene.


    No, because LeanTouch has many inspector events that can be used to call PlayMaker and other scripts.
     
  2. tonygiang

    tonygiang

    Joined:
    Jun 13, 2017
    Posts:
    40
    Hi, I'd like to submit a bug report with Lean Transition: Transitions with duration at exactly 0 will fail to join with other transitions.
    The current workaround is to set the duration of immediate transitions to 1.401298e-45 (the Single Epsilon value of .NET), which is very ugly. I look forward to this bug being fixed soon.
     
  3. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    239
    Hi
    Thank for your great assets !
    I'm building a rhythm game for mobile based on Midi Tool Kit. So, I need a very low latency input system.
    Is Lean is based on the new Unity input system ?
    Have you check the UI latency ?

    Thank
    Thierry
     
  4. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,586
    Thanks, the attached package should fix this!

    The issue was that 0 duration transitions execute immediately, so when you join the next transition to it it never executes the next transition, because the previous transition has already executed.

    Lean Touch works with the old or new input systems automatically.
     

    Attached Files:

  5. erlemaitre

    erlemaitre

    Joined:
    Oct 30, 2018
    Posts:
    24
    Hello,
    I have a question about Lean Button. When pressing with a finger or the mouse a Lean Button with normal, down, and click transitions, the button stays in its pressed state as long as we keep the pointer pressed. Is the same behavior possible for keyboard or game controller ? For now, pressing a key or a gamepad's button instantly triggers all transitions, without being able to keep the button pressed.
     
  6. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    110
    I'm using LeanManualRotate with LeanMultiUpdate to rotate a helix by drag like in the example provided in LeanTouch+. I need to stop the rotation though when my character hits a wall. How can I do this? Is there a way to stop rotation to the right but not to the left? Because I just could put the Axis to 0 or the multiplier to 0 but this will stop the entire rotation, I only need it to stop towards the specific axis the wall is placed as a obstacle.

    Edit:
    I guess the solution is to stop the drag input when it hits the wall, but I can't find a constrain or any other script that possibly could interrupt the drag towards one side only (I can only find stuff related to finger detection but that would interrupt the entire input at once).
     
    Last edited: Jan 10, 2021
  7. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,235
    LeanTransition is excellent.

    Is there a .Scale? like .Translate or .Rotate which handles relative transition of scale.
     
    Last edited: Jan 12, 2021
  8. cihad_unity

    cihad_unity

    Joined:
    Dec 27, 2019
    Posts:
    35
    Hello Carlos,
    Thank you for the amazing asset.
    I have a question (or a possible bug report) for lean touch.

    I have a world canvas and I'm using selectable for selecting objects but looks like there is an offset.
    Also, when I want to drag, it doesn't map 1to1 (i.e. if I drag 2x, the image moves 1x distance)

    The issue was I had two cameras and it was using the wrong camera. Fixed now. Thanks
     

    Attached Files:

    Last edited: Jan 12, 2021
    Darkcoder likes this.
  9. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,235
    is it possible to set an alias on any other variable than the target?
    upload_2021-1-12_19-39-53.png
    Duration for example
    I'm making a dialogue typewriter and I need to set the text dynamically

    if it can be useful to someone, this almost works, not so hot when best fit is on
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3. using System.Collections.Generic;
    4.  
    5. namespace Lean.Transition.Method
    6. {
    7.     /// <summary>This component allows you to transition the specified Image.fillAmount to the target value.</summary>
    8.     [HelpURL(LeanTransition.HelpUrlPrefix + "LeanTextTypewriter")]
    9.     [AddComponentMenu(LeanTransition.MethodsMenuPrefix + "Text/Text.typewriter" + LeanTransition.MethodsMenuSuffix + "(LeanTextTypewriter)")]
    10.     public class LeanTextTypewriter : LeanMethodWithStateAndTarget
    11.     {
    12.         public override System.Type GetTargetType()
    13.         {
    14.             return typeof(Text);
    15.         }
    16.  
    17.         public override void Register()
    18.         {
    19.             PreviousState = Register(GetAliasedTarget(Data.Target), Data.Duration, Data.Ease);
    20.         }
    21.  
    22.         public static LeanState Register(Text target, float duration, LeanEase ease = LeanEase.Smooth)
    23.         {
    24.             var state = LeanTransition.SpawnWithTarget(State.Pool, target);
    25.  
    26.             state.Ease = ease;
    27.  
    28.             return LeanTransition.Register(state, duration);
    29.         }
    30.  
    31.         [System.Serializable]
    32.         public class State : LeanStateWithTarget<Text>
    33.         {
    34.             [Tooltip("The ease method that will be used for the transition.")]
    35.             public LeanEase Ease = LeanEase.Smooth;
    36.  
    37.             [System.NonSerialized] string _oldString, _currentString;
    38.             [System.NonSerialized] int _charCount;
    39.             const string TRANSPARENTRICHTEXT = "<color=#00000000>";
    40.             const string CLOSECOLORRICHTEXT = "</color>";
    41.  
    42.             public override int CanFill => Target != null ? 1 : 0;
    43.  
    44.             public override void BeginWithTarget()
    45.             {
    46.                 _oldString = Target.text;
    47.                 _charCount = _oldString.Length;
    48.             }
    49.  
    50.             public override void UpdateWithTarget(float progress)
    51.             {
    52.                 int currentWordInsertIndex = (int) (Smooth(Ease, progress) * _charCount);
    53.                 _currentString = _oldString.Insert(currentWordInsertIndex, TRANSPARENTRICHTEXT)+CLOSECOLORRICHTEXT;
    54.                 Target.text =   _currentString;
    55.             }
    56.  
    57.             public static Stack<State> Pool = new Stack<State>(); public override void Despawn() { Pool.Push(this); }
    58.         }
    59.  
    60.         public State Data;
    61.     }
    62. }
    63.  
    64. namespace Lean.Transition
    65. {
    66.     public static partial class LeanExtensions
    67.     {
    68.         public static Text typewriterTransition(this Text target, float fillAmount, float duration, LeanEase ease = LeanEase.Smooth)
    69.         {
    70.             Method.LeanTextTypewriter.Register(target, duration, ease); return target;
    71.         }
    72.     }
    73. }
     
  10. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,586
    It depends how you're triggering these transitions using your gamepad or keyboard. Are you using the standard UI navigation features, or something else?


    I'm not sure what you mean by rotation hitting a wall in only one direction, are you trying to simulate something like a ratchet gear? If so, is easiest solution is a custom script, because this is a very game specific feature.

    What you would need is something like the LeanRoll component, whose IncrementAngle method can be called from the LeanMultiDirection component. You would then modify the IncrementAngle method so that if it's negative, you clamp/restrict it based on the current Angle value. If you need help with this let me know.

    Try the attached package. This adds the new Style setting to the LocalScale transition:

    upload_2021-1-13_14-12-10.png

    Alias can only be used for Target. You can change the speed of transitions from a transition player by right clicking it and selecting Speed:

    upload_2021-1-13_14-14-46.png
     

    Attached Files:

    laurentlavigne likes this.
  11. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,235
    Gotcha, so no way to inject a string directly, it would have to be in the target text component already.
    Thanks for the extra option in scale, super useful.
    What is the method which is called when the current transition is being kicked out by a new one? Despawn doesn't seem to be called in such case.
    I need that to reset the string to its original because currently if I interrupt typewriter in the middle then the Text component text field is polluted with <color=#00000000> and such.
     
    Last edited: Jan 13, 2021
  12. erlemaitre

    erlemaitre

    Joined:
    Oct 30, 2018
    Posts:
    24
    I'm using the standard navigation, playing around in the example scene "Selection Highlight" from Lean GUI.
    PS: Is there a way to visualize navigation with Lean Button ?
     
  13. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    110
    I probably should have asked different so sorry for the confusion. Is there a way to stop the input in a finger drag towards a specific axis completely?
     
  14. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,586
    The Alias system was made so you can place transitions in prefabs. This is required because prefabs can't reference scene objects, and since almost every transition requires a reference to a Target they wouldn't be able to function.

    There's no method called when ending a transition except for the transition's own Update/UpdateWithTarget methods, which will be called with a progress value of 1. If you need to reset something after a transition ends you can join the transition to the EventTransition, and reset it there. Unless I misunderstand your question?


    Isn't the LeanButton behaviour the same as Unity's Button with keyboard navigation? It's been a while since I looked into it, but I think the way the keyboard sends the submit event is out of my control and there's no way to detect when it goes down or up without rewriting the whole keyboard navigation.


    You mean like detect when the finger is moving left or up, but not down or right?

    LeanTouch+ comes with the LeanMultiDirection component, which can be used to do this, and in fact it can detect movement in any angle either in one direction, or both ways. This setup doesn't work with components like LeanDragTranslate though, it has to be used with components like LeanManualTranslate.
     
  15. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,235
    That was it. thanks!
     
    Darkcoder likes this.
  16. erlemaitre

    erlemaitre

    Joined:
    Oct 30, 2018
    Posts:
    24
    LeanButton behaves just like standard buttons so it's not an issue ; I thought the standard behavior was to be pressed while the key is pressed. Anyway, thank you for the great asset ! :)
     
  17. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,586
    Yeah, as far as I know the keyboard navigation only tells you when you move in a direction, hit submit, or hit cancel, there's no down or up event. There is a down and up event for the mouse/fingers though, which is why I could add those more advanced transitions.

    Let me know if you encounter any other issues!
     
  18. tonygiang

    tonygiang

    Joined:
    Jun 13, 2017
    Posts:
    40
    Hi, I'd like to make a feature request to Lean Transition: Follow Transform transition (with offset). I get that this can already be done by setting the target's parent transform to the destination transform and then join with a local position transition, but this workaround will change the scene hierarchy, which can result in unforeseeable side-effects. A Follow Transform transition would be safer and more convenient.
     
  19. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,586
    This can be done with something like the attached script. The current transitions basically extend all the existing methods though, and there is no built in follow method.
     

    Attached Files:

  20. karmington2

    karmington2

    Joined:
    Jul 30, 2018
    Posts:
    8
    Re: LeanLocalization

    The LeanLanguageCSV doesn't work with long texts since it is not parsing csv properly with string delimiters. CSV files have string delimiters, typically " or ' which control long text areas and allow for line breaks.

    Please consider implementing a proper CSVReader
     
  21. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,586
    If I implemented such projects then it would no longer be lean :D

    If you have examples of widely used CSV formats then I can try implementing them.
     
  22. karmington2

    karmington2

    Joined:
    Jul 30, 2018
    Posts:
    8
    Greets Darkcoder. I hacked in https://github.com/frozax/fgCSVReader to get it to work, it was not much trouble.

    The thing is, the CSV support is problematic since your default format

    Item=Translation//Comment\n


    is not compatible with .csv file format - it would be like this with a ',' separator.

    Item,Translation,Comment\n


    P.S. Do note that the example also loads .txt files, not .csv files. So saying you support .csv files is misleading, once you add string delimiters. With all due respect, I only wish to make sure you have happy customers : )
    More on csv files ( which are sadly not properly standardized, the best seems to be RFC4180 https://en.wikipedia.org/wiki/Comma-separated_values ) EDIT Just noticed using ; is not 4180 standard... but anyway Excel,OpenOffice,LibreOffice support it.

    EDIT Here's a snippet of our .csv file ( using semicolon separators )


    EmotionNames_WORRIED;Worried
    EmotionNames_NERVOUS;Nervous
    EmotionNames_LOVE;In Love
    EmotionNames_RELIEVED;Relieved
    Choose_language;Choose language
    InfoPage_1_title;Welcome to XYZ!
    InfoPage_1;"XYZ is an educational, playful application for small children where they can explore and learn how to identify their emotions. The app can be used in early childhood education by children and teachers, or at home with parents.
    The application is child-safe, which means that we don’t collect any data, it’s free of advertising and there are no in-app-purchases within it. It is based on the Finnish curriculum for early childhood education and we have been cooperating with researchers, teachers, and kids to produce the best possible content. XYZ is a fun and creative way to explore and discuss emotions.
    Happy playing
    XYZ Team"


    How I changed the code in LeanLanguageCSV.cs ( note that I didn't bother with the comment field, it was not critical for us.

    for (var i = Entries.Count - 1; i >= 0; i--) // NOTE: Property
    {
    entryPool.Push(entries[i]);
    }
    entries.Clear();
    fgCSVReader.LoadFromString(Source.text, new fgCSVReader.ReadLineDelegate(MyReader));


    void MyReader(int lineIndex, List<string> line)
    {
    var entry = entryPool.Count > 0 ? entryPool.Pop() : new Entry();
    entry.Name = line[0];
    entry.Text = line[1];
    entries.Add(entry);
    }
     
    Last edited: Jan 21, 2021
  23. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    110
    In LeanTouch+ is it possible to limit the speed of an object that is moved by drag? Without changing values of the input itself?
     
  24. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    110
    And another question: which movement for drag-swipe would use rigidbody.MovePosition to work flawlessly with rigidbodies on X and Z axis? Thanks.

    Edit: I think Lean Drag Translate Rigidbody uses Rigidbody.MovePosition but there is no setting for multiplier or anything to change the speed of the movement... do I miss something? And how could I access the movement direction in order to rotate the gameobject to look always towards the front?

    I was also wondering if there is the equivalent for Rigidbody.MoveRotation?

    Cheers!

    Edit 2: and since you haven't replied yet, how can Translate Rigidbody be used for specific axis? I would like to use X and Z, not Y... seems that script hasn't anything to select this from...
     
    Last edited: Jan 26, 2021
  25. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,586
    Interesting. I've modified the component to allow users to pick the formatting of the text. When I have more time I'll look into implementing RFC 4180 and with semicolon.


    You can use the LeanChase component for this (Lean/Touch+/Examples/Follow). The examples use exponential damping, but you can set that to 0 and use the Linear setting to make it a set speed.

    LeanDragTranslate works the same as LeanDrag, which just uses the camera orientation with the exact finger movement. For a specific movement plane with a custom distance multiplier you must use the LeanMultiUpdate and LeanManualTranslateRigidbody components. LeanMultiUpdate has the OnWorldDelta event, which you can connect to LeanManualTranslateRigidbody.TranslateWorld. Also set LeanMultiUpdate.ScreenDepth = HeightIntercept (XY plane), and it should work. You can set the multiplier in LeanManualTranslateRigidbody.Multiplier.

    For rotation you can use the LeanRotateToPosition component. Or you can use this same OnWorldDelta to calculate this yourself.
     
  26. raksoff

    raksoff

    Joined:
    Oct 8, 2020
    Posts:
    2
    Please tell me how to implement. I have to do. Select a cube, move it and put it on the point. But what would be on the point if there is another cube, they swapped places. I do it through Lean.Case. But I cannot pass the parameters of the new position there. And the cube just doesn't move on its own while Lean.Case is on. Please help me.
     
  27. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,586
    LeanChase will 'chase' the currently set Position + Offset values. If you want to swap object places then you must manually modify these values, otherwise your changes will be ignored/reverted. You could also disable the component when you swap places.
     
  28. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    110
    I can't find the LeanManualTranslateRigidbody.TranslateWorld but when I select the LeanManualTranslateRigidbody.TranslateAB it seems to work like intended.

    Seems there is nothing I could hook it up to when choosing LeanRotateToPosition. Are you sure this is the correct component? In case it is and I have to manually calculate it, could you give me an example? I am not a coder and use Playmaker if at all to make this work.

    A new component specially for Rigidbody rotate (or torque I guess it is) would be awesome to have in the asset. Pretty much the same as LeanManualTranslateRigidbody but for rotation. :)
     
  29. StarFluke

    StarFluke

    Joined:
    Jan 19, 2013
    Posts:
    36
    Is there any way to catch Destroy On Scene Load and have it Despawn instead? I want it to go away at scene load but stay in the pool.
    Thanks.
     
  30. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,586
    LeanManualTranslateRigidbody.TranslateWorld is a method that accepts a Vector3, and you can hook from an event that also sends a Vector3, like OnWorldDelta:

    upload_2021-1-29_11-38-28.png

    LeanRotateToPosition automatically rotates based on changes to its position.

    You can just insert your code to pool the things you need before you trigger the level load? There's probably a way to detect when a scene is about to change, but I don't know off the top of my head.
     
  31. StarFluke

    StarFluke

    Joined:
    Jan 19, 2013
    Posts:
    36
    Yes, thank you. I agree with you. :)
     
    Darkcoder likes this.
  32. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    110
    I'm still not getting it. Sorry for that.

    So I have a gameobject I want to rotate on its pivot. And I want it to do that depending on if the user drags left or right (which makes it rotate towards the left or right).

    Por this purpose I attached to that gameobject a:
    1. Lean Multi Update
    2. Lean Manual Translate Rigidbody
    3. Lean Rotate To position

    I link the LeanManualTranslateRigidbody.TranslateWorld to the On World Delta (Vector3) event but it just will move, not rotate. I'm probably missing something obvious so sorry for the rookie questions and thanks a lot for your support.
     
  33. jimmying

    jimmying

    Joined:
    Sep 20, 2017
    Posts:
    36
    Hey Carlos,

    I might be having an issue with the LeanFinger GetSnapshot methods, or maybe I am misunderstanding them.

    So I've got a LeanFingerUpdate component with the following function added to the OnFinger event.

    Code (CSharp):
    1.     public void HandleFinger(LeanFinger finger)
    2.     {
    3.         Debug.Log(finger.GetSnapshotScaledDelta(1).magnitude);
    4.     }
    My understanding is that when you mouse/finger down, and start moving/dragging your finger around, it should print the delta since 1 second ago. But when you leave your finger in one position for 1+ seconds, the logs should read a delta of 0.

    So that seems correct to me and happens most of the times, but sometimes, when you stop moving your finger, the delta will gradually decrease but will not reach 0. It ends up just getting stuck at a number. Like maybe 1 in 5 times, it won't reach 0.

    Hope that makes sense. Tested with LeanTouch+ 2.2.3.
     
  34. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,586
    Oh I see, if you only care about rotation then you can try the "Lean/Touch+/Examples/Drag/04 DragTurn1D" demo scene.


    To save memory snapshots are only stored if your finger moves far enough. You can control this setting from the LeanTouch component's RecordThreshold setting. Setting it to 0 should make it always record, maybe.
     
  35. caglarenes

    caglarenes

    Joined:
    Jul 9, 2015
    Posts:
    39
    Hello. Thanks a lot for these good assets firstly.

    Lean Pinch Camera throws that error every time on Editor GUI. So I can't change it's options like "Ignore on GUI" or "Required Selectable" on Inspector. But it works on play mode by the way.


    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. Lean.Common.LeanInspector`1[T].Draw (System.String propertyPath, System.String overrideTooltip, System.String overrideText) (at Assets/Lean/Common/Scripts/LeanInspector.cs:204)
    3. Lean.Touch.Inspector.LeanPinchCamera_Inspector.DrawInspector () (at Assets/Lean/Touch+/Scripts/LeanPinchCamera.cs:244)
    4. Lean.Common.LeanInspector`1[T].OnInspectorGUI () (at Assets/Lean/Common/Scripts/LeanInspector.cs:55)
    5. UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <1b64b06f536e44ebb2ace8cd6da8538a>:0)
    6. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    7.  
     
  36. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    110
    The problem with this is that it doesn't use rigidbody hence it doesn't recognize collisions. I think for this purpose it needs torque if I'm not mistaken. Like with the movement that uses velocity instead. Does that make sense?
     
  37. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,586
    Thanks, I'll send you a private message with a new build in a sec!


    Ah I see, I'll see what I can do.
     
  38. ironwolf

    ironwolf

    Joined:
    Oct 26, 2010
    Posts:
    8
    I have the same issue - why not share new build with everyone?

    BTW. I'm using your assets for years and totally love all your works. I think it should be included into Unity as a standard package like Bolt :)

    Quick-fix: change "Zoom" to "zoom" in line 244
     

    Attached Files:

    Last edited: Feb 2, 2021
  39. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,235
    Is there a way to access a monobehavior I just want to turn moveController.enable=false/true
    Code (CSharp):
    1.     MonoBehaviour moveController => (MonoBehaviour) Player.me.thirdPerson;
    moveController is not showing
    upload_2021-2-2_21-37-24.png
     

    Attached Files:

  40. erlemaitre

    erlemaitre

    Joined:
    Oct 30, 2018
    Posts:
    24
    Hello,
    I have a question regarding Lean Localization. When I add Chinese to the LeanLocalization component, all the culture codes for Chinese are added, but the first two cultures are ChineseSimplified and ChineseTraditional. Are these pseudo culture codes for every simplified/traditional variations ?
     
  41. OmnifariousStudios

    OmnifariousStudios

    Joined:
    Mar 12, 2018
    Posts:
    20
    Hello!

    Loving LeanPool asset so far, but I have some questions as object pooling isn't something I've really dived into:

    1. Is there a way to pool multiple types of a similar object in the same pool? I have an enemy that has 12 different possible masks to wear on their head, but I dont want to spawn all 12 masks on every enemy and only enable one (the masks themselves are pretty HD and costly), so is there a way to hold all masks in the pool and spawn a random one to put on an enemy? Or should I just use 12 different smaller pools with a few copies of a mask in each pool?

    2. Kind of related to the above, but all of my enemies are pretty complex and have a ton of stuff on them: AI systems, puppetmaster ragdolls, some IK, special effects, etc. I know instantiating and destroying many of these is obviously expensive, but are they too expensive/complicated to see performance enhancement if I make object pools out of them? Any advice for spawning really complicated gameobjects like these?

    3. How many object pools is too many? Or is the golden rule just: Try to object pool everything you can and let it all get created at the beginning?

    Thanks!
     
  42. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,235
    to access TMP text field in ultEvent I need to go through 5 submenus at the moment which is not practical so I was wondering if there is a setting to make it as easily accessible as UnityEvent.
    upload_2021-2-3_22-33-45.png
     
  43. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,586
    Because this script is part of the paid version and I don't want to give everyone access to it.

    No idea, I just copied and pasted what Unity has in their language list. I imagine they wrap the culture codes to be easier to understand, so I just included both approaches.

    1 - You can change the pool's prefab randomly at spawn time to get this behavior (should work, but I haven't tested it).

    2 - Benchmark it and see.

    3 - Depends on the object, but #2 should be applied to all optimizations.


    What am I looking at? Doesn't look like any of my assets.
     
  44. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,235
    sorry wrong guy
     
  45. erlemaitre

    erlemaitre

    Joined:
    Oct 30, 2018
    Posts:
    24
    Okay, thank you! Also, I believe there is an issue with the "detect language" feature. Each time I run the game with CurrentCulture or CurrentUICulture, it's always in English (en-US) (while my system is in French). There is only with the SystemLanguage option that the French translations appears.
     
  46. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,586
    Are you talking about what's displayed in the UI here:

    upload_2021-2-5_9-38-36.png

    If so, this just directly outputs what C# gives me:

    Code (CSharp):
    1. case LeanLocalization.DetectType.SystemLanguage:
    2.                             EditorGUILayout.TextField("SystemLanguage", Application.systemLanguage.ToString());
    3.                         break;
    4.                         case LeanLocalization.DetectType.CurrentCulture:
    5.                             EditorGUILayout.TextField("CurrentCulture", System.Globalization.CultureInfo.CurrentCulture.ToString());
    6.                         break;
    7.                         case LeanLocalization.DetectType.CurrentUICulture:
    8.                             EditorGUILayout.TextField("CurrentUICulture", System.Globalization.CultureInfo.CurrentUICulture.ToString());
    9.                         break;
    Even though my system is set to UK it shows this, so perhaps this value is giving me this:

    upload_2021-2-5_9-41-23.png

    Maybe I'm reading the wrong property.
     
  47. erlemaitre

    erlemaitre

    Joined:
    Oct 30, 2018
    Posts:
    24
    It appears that this is a bug within Unity when using CultureInfo on macOS, so this is not linked to your asset.
     
  48. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    110
    I got three more question regarding LeanTouch+ if you don't mind.

    The first one is about the finger drag. When I drag slowly the player rotates/moves much faster than when I drag fast. It's almost like if there is a sensitivity threshold or something that blocks faster movement. I tried to play with the screen percentage multiplier as well as with the torque multiplier, yet the behavior persists. Not sure if that makes sense. But I can put 10,000 multiplier and it still doesn't rotate/move faster. How can I get rid of that limitation?

    The second question is about the finger amount. Which I didn't find an answer in the forum nor in the documentation either (sometimes I wished the documentation was a bit more extended in order to find the answer myself). But how can I make it so LeanTouch only recognizes one finger at a time? I would like to block all other touch input while one finger is already on the screen. By default it seems to recognize any amount of fingers and I only found a minimum finger amount setting but not a maximum amount. How to solve this?

    And last but not least, about the Playmaker actions someone asked you over two years ago here in the forum (https://forum.unity.com/threads/lea...ion-leantransition.720119/page-3#post-5159258). I really would love if some basic variables and methods could be accessible. Like stop input, stop speed,rotation,movement, respectively get and set of the most common variables that are not exposed in the inspector and can't be accessed without scripting. Not being able to access those makes the asset much more limited with Playmaker unfortunately.

    But anyways, thanks so much for all the support. Great stuff.
     
  49. Head-Trip

    Head-Trip

    Joined:
    Oct 21, 2016
    Posts:
    1
    Which is the paid version? I get a similar error with the joystick from LeanGui. I already own LeanTouch+.

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. Lean.Common.LeanInspector`1[T].Draw (System.String propertyPath, System.String overrideTooltip, System.String overrideText) (at Assets/Lean/Common/Scripts/LeanInspector.cs:203)
    3. Lean.Gui.Inspector.LeanJoystick_Inspector.DrawInspector () (at Assets/Lean/GUI/Scripts/LeanJoystick.cs:283)
    4. Lean.Common.LeanInspector`1[T].OnInspectorGUI () (at Assets/Lean/Common/Scripts/LeanInspector.cs:55)
    5. UnityEditor.UIElements.InspectorElement+<CreateIMGUIInspectorFromEditor>c__AnonStorey1.<>m__0 () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorElement.cs:501)
    6. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
     
  50. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,586
    Interesting, perhaps it's fixed in a new version, or you can use the SystemLanguage which seems to be implemented using something different.


    1 - Can you post a screenshot of your components and their settings related to this issue?

    2 - Which components are you referring to? There are 2 main types of components: ones that listen for each finger individually (e.g. LeanFingerTap), and ones that can listen for multiple (e.g. LeanMultiPinch). The ones that can listen for multiple usually have the RequiredCount or RequiredFingerCount settings:

    upload_2021-2-6_20-51-59.png

    upload_2021-2-6_20-52-13.png

    These allow you set the amount of fingers you must use for the component to do anything. There's no way to set a min and max range though. In this scenario you could use multiple components with different required counts. You can also use the LeanMultiDown and LeanMultiUp components to enable/disable a component based on the amount of fingers currently touching the screen, but this won't work with all components because some components need to be activated all the time so they can listen for fingers.

    3 - Which components and settings are you referring to? Most components can be modified externally using events, and you should be able to do this from PlayMaker.


    The previous error was from LeanTouch+. Thanks for pointing this new error out, I'll submit a fix now, also LeanShake has the same issue.
     
unityunity