Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

New UI Widgets

Discussion in 'Assets and Asset Store' started by ilih, Feb 11, 2015.

  1. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    904
    please explain Max Display Size and Default Display Size?
     
  2. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    904
    @ilih
    Great work on this LayoutSwitcher update, its 90% working according to workflow earlier mentioned.
    However view doesnt update on some cases

    For example, i added 2 aspect ratios
    1- portrait 9:16 (iphone x)
    1- landscape (4:3)

    Now if i chose any portrait aspect ratio on runtime, which means value will be always less than 1 (width/height = 9/16 = 0.5625) so your code should see if there is any aspect ratio with portrait (less than 1). In my case there is only 1, portrait so it should show it, otherwise if aspect ratio is landscape (greater than 1) then it should fall back to landscape.

    Now imagine i have 2 landscape aspect ratios 4:3 = 1.33 and 16:9 = 1.7
    now if current aspect ratio divided value should be close one of these 2 values, if its closer to 16:9, set 16:9 if its closer to 4:3 (as 1.33) then set it to 4:3 settings.

    Thanks



    Update
    To explain further, limitation of last build is as i have 2 aspect ratios
    9:16 potriat, and 4:3 landscape
    then my potrait view (current scene) will only change its layout, if i precisely set 4:3 aspect ratio otherwise it will remain in portrait even if my current aspect ratio is 5:3, 3:2 etc
     
  3. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    Default Display Size - Display size used when actual display size cannot be detected.
    Max Display Size - layout will be used if max size greater or equal to Display Size.
    All sizes in inches, actual display size calculated with Screen.dpi.
     
  4. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    This done with this code
    .OrderBy(x => Mathf.Abs(aspectRatio - x.AspectRatioFloat))
    to find closest aspect ratio.

    Then you can use such code:
    Code (CSharp):
    1.         UILayout SimpleSelector(List<UILayout> layouts, float displaySize, float aspectRatio)
    2.         {
    3.             // if aspect_ration 4:3
    4.             if (NearlyEqual(4f / 3f, aspectRatio, 0.001f))
    5.             {
    6.                 var layout_4_3_index = 0;
    7.                 return layouts[layout_4_3_index];
    8.             }
    9.  
    10.             var layout_9_16_index = 1;
    11.             return layouts[layout_9_16_index];
    12.         }
    13.  
    14.         public static bool NearlyEqual(float a, float b, float epsilon)
    15.         {
    16.             if (a == b)
    17.             {
    18.                 return true;
    19.             }
    20.  
    21.             var diff = Mathf.Abs(a - b);
    22.  
    23.             if (a == 0 || b == 0 || diff < float.Epsilon)
    24.             {
    25.                 return diff < (epsilon * float.Epsilon);
    26.             }
    27.  
    28.             var absA = Mathf.Abs(a);
    29.             var absB = Mathf.Abs(b);
    30.  
    31.             return diff / (absA + absB) < epsilon;
    32.         }
    33.  
     
    jGate99 likes this.
  5. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    904
    Oh, so just to reconfirm, So layoutSelector callback can make the decision of what layout to use and LayoutSelector then display that layout which it gets from callback? right?
    thats even better :)
     
  6. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    Yes.
     
    jGate99 likes this.
  7. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    904
    @ilih,

    please add isOnWithoutEvent property so it doesnt dispatch onValueChange,

    Reason is i want to set default values and action handler gets trigger, one way is to explicitly ignore it adding code in all screens where im using them but adding this property in switch will make life easier.
     
  8. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    You can use
    Switch.SetStatus(bool isOn)
    function to change IsOn without event invocation.
     
    jGate99 likes this.
  9. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    904
    @ilih, how can i do both SetStatus and disable switch animations (only when im calling SetStatus) to avoid this error


    Code (CSharp):
    1. Coroutine couldn't be started because the the game object 'PrefabSwitch' is inactive!
    2. UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    3. UIWidgets.Switch:SetMarkPosition(Boolean) (at Assets/New UI Widgets/Scripts/Switch/Switch.cs:332)
    4. UIWidgets.Switch:SetStatus(Boolean) (at Assets/New UI Widgets/Scripts/Switch/Switch.cs:284)
     
  10. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    You need to modify SetStatus:
    • add "animate" argument to SetStatus method:
      public void SetStatus(bool value, bool animate = true)
    • and use it is SetMarkPosition call:
      SetMarkPosition(animate);
    Now you can use
    Switch.SetStatus(isOn, false)
    to set state without using animation.
     
    jGate99 likes this.
  11. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    904
    Is there PickerString Example scene?
    Thanks
     
  12. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    No, but you can use PickerInt example ("Open Picker" button under the Miscellaneous tab in the main scene). The only difference is a type of the value.

    Code (CSharp):
    1.         [SerializeField]
    2.         protected PickerString PickerTemplate;
    3.  
    4.         string currentValue = string.Empty;
    5.  
    6.         public void Test()
    7.         {
    8.             // create picker from template
    9.             var picker = PickerTemplate.Clone();
    10.  
    11.             // set values from template
    12.             picker.ListView.DataSource = PickerTemplate.ListView.DataSource.ToObservableList();
    13.  
    14.             // show picker
    15.             picker.Show(currentValue, ValueSelected, Canceled);
    16.         }
    17.  
    18.         void ValueSelected(string value)
    19.         {
    20.             currentValue = value;
    21.             Debug.Log("value: " + value);
    22.         }
    23.  
    24.         void Canceled()
    25.         {
    26.             Debug.Log("canceled");
    27.         }
     
    Last edited: Dec 11, 2018
    jGate99 likes this.
  13. Yerkisk

    Yerkisk

    Joined:
    Jul 28, 2015
    Posts:
    13
    The Popup script doesn't seem to support TextMeshPro. The Text fields for the header and content text only accept normal Text fields and not TextMeshPro texts like the other components do. Dialog seems to work, just Popup that doesn't.
     
  14. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    The Popup gameobject have DialogInfoTMPro component, this component contains references to Header and Text gameobjects and used to display header and content text. (You do not need to use it directly, it will be used automatically if it added to Popup gameobject)
    It should exist by default if you created Popup correctly (TextMesh Pro support enabled and Popup created with menu "UI/UIWidgets with TextMesh Pro/Dialogs/Popup")
     
    Last edited: Dec 12, 2018
  15. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    190
    Unless I missed something, the Spinner is not using TextMesh Pro.
    It works with Tabs and ListView, but not Spinner which is still using the standard Unity Text.

    I tried both Spinners using the latest New UIWidgets version.
     
  16. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    Yes. Spinner is class inherited from InputField class and it was impossible to make it work with TextMesh Pro, so I am reworking Spinner right now to add TextMesh Pro support (Inheritance already removed in the last beta).
     
  17. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    190
    Nice!
    Thanks for your work.
     
  18. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    Please check v1.10.2b9 with updated Spinner with TextMesh Pro support.
    After the update, you will need to import the TMPro support package with "Edit / Project Settings / New UI Widgets / Import TextMesh Pro support package"
     
    Last edited: Dec 13, 2018
  19. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,436
    Really needs an update to properly support TMP everywhere in the package/demos/prefabs and scripts... like TMP is officially in unity as a package now.. <Text> might aswel be dead it's old and not all that great especially with TMP supporting dynamic fonts now (2018.3 onwards)

    and its not something I want to go through updating scripts for the package when an update will overwrite them.. just gets messy, please update
     
  20. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    Please, can you be more specific about the problem with TextMesh Pro?
    TextMesh Pro is supported: separate prefabs and scripts with TMP support are included in the package (and with the latest beta update it's available for all widgets with text). For now no demos with TMP and not sure if it's really needed - the only difference will be in the scene, scripts do not require any changes.
     
  21. Yerkisk

    Yerkisk

    Joined:
    Jul 28, 2015
    Posts:
    13
    Concerning the popup, if you create a new popup with TMPro support enabled, the Title Text and Content Text of the popup script are empty as they are old Text component and not TMPro Text components so you cannot reassign them unless you rewrite the class. Even if the dialog info has TMPro support, if you do a popup.show with a title and message, they are not showing.

    Wrote a new class to change this, updated all text component of popup to textmesh pro and then it works.
     
  22. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    Strange, I just checked it and it's work without a problem. And recorded video of the test.
    Maybe font is missing but should be errors about it.

    What Unity version are you use?
     
  23. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    190
    Thanks!
    Just tried it, and it works perfectly.

    I have a minor problem with the tooltips, I have set its text to justified, and as long as it is not displayed it stays justified.
    But when it is displayed it automatically changes to a left alignement.
    Changing the size of the font works fine, but not the alignement.
     
  24. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    RectTransform anchors of the text gameobject are controlled by Horizontal Layout group.
    Tooltip itself does not control Text alignment, maybe you have some other script that changes alignment - try to create a new empty scene with a single button and Tooltip and check alignment with it.
     
  25. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,436
    yeah nvm it seems I had used a scene prefab (actually are the demo scenes all using the old the old text version?) anyway noticed the script for them was just hardcoded with Text, but on looking at the TMP version prefabs you use another additional script on some of the components to update for TMP.. so wasn't much problem adding that addition
     
  26. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    There are few problems with using TextMesh Pro by default and completely discard Text:
    • 3 different versions of the TextMesh Pro: paid AssetStore version (not available now, but still used), free AssetStore version, free built-in package version, they all use different GUID so scenes and prefabs with TMPro not compatible between different versions, unless you use tools like "Project file GUID remapping tool" to convert scenes and prefabs to required version which is not the best solution for paid assets.
    • AssetStore approve process: in the case of the built-in package you still need to import fonts and other resources without it, you will get missing references errors. Same applied to the automated tests to check submitted asset package, and the package will be rejected because of the missing references errors. (I do not know how exactly approve process work, but pretty sure it matches with my description)
    • The built-in package itself can be uninstalled: so after import will be not only missing references errors but also code errors.
    • Built-in packages are available only in the Unity 2017.3 (or 2017.4?) and later versions. But dropping support of the previous Unity versions is not an option.
    I am thinking about the possible solution: replace Text in example scripts with some proxy script and add a tool to replace Text components with TMPro in the scene automatically.
     
    hopeful likes this.
  27. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    190
    Anybody serious about using TMP knows about the issues coming from the 3 different versions of TMP, so I'm not sure it's really a problem.
    As for the lack of TMP in the new UI Widgets examples, it's not a real problem either because we can still open another Unity with the examples in order to see how it's done, while still be working on our own project on another Unity.

    I expect that New UI Widgets will sometimes go for TMP as primary text solution in some time.
    But for now it's clear that most people are still using the standard Text component, so I'm ok with this asset using Text by default, even if I am not using Text anymore.


    That said, I saw that when using "Edit / Project Settings / New UI Widgets / Import TextMesh Pro support package", the source files in 'Third party' are modified with a comment at the end.
    I understand it is to force the recompile of the project, but it's also messing with source control which is a real problem.
    Maybe it is possible to do either (or both):
    - modify only one file (if one source file is modified in a dll, then the dll will be completely rebuilt, so there's no need to modify more than one file). It would mess a bit less with the source control
    - add some text to one of the source files (as currently), save, and then remove it and re-save. It should have the same effect as the file will be considered as having been modified, but at least it won't mess at all with source control
     
  28. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    It is a problem with Unity 2018.1 and 2018.2 only: unless file itself changed it's can not be used as a MonoBehavior component, and when selecting a file you see a message "No MonoBehaviour scripts in the file, or their names do not match the file name.".
    Modify only one file fix problem for this file only.
    I submitted it as a bug, but receive no response.

    Possible solutions:
    • Try Unity 2018.3. I do not check stable version yet, but the beta does not have this problem
    • Comment line "Compatibility.ForceRecompileByLabel("TMProFolder");" in file ThirdPartySupportMenuOptions.cs and check how it works
    • Use this script to remove added text in the source files

    After first save should be called
    AssetDatabase.Refresh()
    to recompile file, it cannot be done after re-save because the file will be same and recompile not happen.
    I suspect there is a chance that after
    AssetDatabase.Refresh()
    code execution will be stopped because of recompilation, but I'll still check it.
     
  29. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    190

    Thanks, as always your answers are fast and efficient, continue the good work!
     
  30. YuriPetskus

    YuriPetskus

    Joined:
    Jun 22, 2018
    Posts:
    16
    Ilih,
    may be it would be better to set Text property of StyleSupportTooltip not GameObject, but Text.
     
  31. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    Default Text component can be replaced with TextMesh Pro, and if I change the type to Text then style will not work with TextMesh Pro. But with GameObject can be used any text component and style will apply without a problem.
     
  32. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    904
    Hi, im using easy layout as grid.
    How do i get cell size? i tried ui size and block size but they give wrong values
     
  33. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    It's not possible. Cells in the different columns and rows can have different widths and heights.
    The EasyLayout is done to create layouts which not possible to create with default layout grouds, so EasyLayout grid is working differently than the default Grid Layout Group with fixed cell size.

    For example grid with the first row has a different height than others and the second column has a different width than others.
     
    Last edited: Jan 18, 2019
  34. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    904
    in my case, im using a perfect square grid.
    so how do you suggest i get this value?
    thanks
     
  35. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    Get the size of the first child gameobject.
    Code (CSharp):
    1.         public EasyLayout Layout;
    2.  
    3.         public void Test()
    4.         {
    5.             Debug.Log("Cell size: " + GetSizeOfTheFirstChild(Layout));
    6.         }
    7.  
    8.         Vector2 GetSizeOfTheFirstChild(MonoBehaviour component)
    9.         {
    10.             if (component.transform.childCount == 0)
    11.             {
    12.                 return Vector2.zero;
    13.             }
    14.  
    15.             var rt = component.transform.GetChild(0) as RectTransform;
    16.  
    17.             return rt.rect.size;
    18.         }
     
    jGate99 likes this.
  36. TigerHix

    TigerHix

    Joined:
    Oct 20, 2015
    Posts:
    19
    This looks like a very promising asset. However, I have some questions:

    1) I don't see how visualization is done in the TileView documentation. Are there event methods such as OnRender() that will be called when a tile appears in sight and OnDestroy() that will be called when a tile is out of sight?

    2) Is it possible to add paddings/custom elements at the top and the bottom of the TileView? For your reference, I would like to recreate something like this: https://cytoid.io/browse. I want the whole scene to be scrollable, not just the TileView, but I need to be able to add padding/custom elements at the top and the bottom of the TileView in order to do that.

    3) Is it possible to implement a horizontal, automatically-snapped ScrollView with any widgets from this asset? It will even be better if the elements can have in/out transitions, similar to https://assetstore.unity.com/packages/tools/gui/simple-ui-scroll-view-extensions-93873.

    4) I see Data Bind is supported by this asset, but to what extent? The documentation confuses me a little bit.

    Sorry to bother with so many questions!
     
    Last edited: Jan 22, 2019
  37. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    Yes, functions in DefaultItem component class:
    • SetData() called when the tile displayed or recycled
    • MovedToCache() called when the tile is out of sight
    TileView (and other widgets to display collections) consist of the three classes:
    • your custom data type (class, struct or interface)
    • TileView class (required because of the generic components not allowed)
    • DefaultItem class to control tile view
    TileView and DefaultItem classes created with widget generation for your type and you will need only to modify created DefaultItem class if it needs at all.

    Adding paddings/custom elements at the top, and the bottom of the TileView is impossible.
    But you can put elements together with TileView in outer ScrollRect and then disable scrollbars and scroll option for TileView.ScrollRect to achieve the same result.
     
    Last edited: Jan 22, 2019
    TigerHix likes this.
  38. TigerHix

    TigerHix

    Joined:
    Oct 20, 2015
    Posts:
    19
    Awesome! Thanks for the quick reply. How about the other two questions?
     
  39. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    Horizontal is possible (there is the option for the scroll direction).
    Sorry, what is "automatically-snapped" mean?

    There are no default transitions, but they can be added with code or with Selectable transitions.

    It's support for the Data Bind for Unity.
     
    TigerHix likes this.
  40. TigerHix

    TigerHix

    Joined:
    Oct 20, 2015
    Posts:
    19
    "Automatically-snapped" means the scroll view will center at an element. Imagine a card-like level selection interface. The player swipes left and right, and the scroll view always automatically snap to a card. You can check out a demo here: https://alchem.itch.io/scroll-extensions

    By transition I actually mean the focus/defocus animation. In the demo above, you can see that the selected card will be enlarged with an animation, and other cards will shrink.

    For Data Bind, I do know it's the Data Bind for Unity asset ;) Just wondering what degree of support was added. Does that mean we can just treat New UI Widgets as Unity Widgets and bind contexts to them?
     
  41. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    It can be done by overriding some methods of the ListViewPaginator to scroll to center on swipe (drag end).

    Possible with Selection.Transitions or with OnPointerEnter/OnPointerExit or OnSelect/OnDeselect events of the DefaultItem class.

    Yes.
    Now there is one flaw: scripts for Data Bind support not created automatically with widget generation, those scripts should be created with context menu on widget class (similar to the widget generation)
     
    TigerHix likes this.
  42. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    904
  43. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    Example scenes are located in "New UI Widgets/Examples/TileView" folder.
    TileView widgets can be created with widget generation.

    Planned, probably in v1.10.3 or v1.10.4 release.
     
    jGate99 likes this.
  44. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    904
  45. TigerHix

    TigerHix

    Joined:
    Oct 20, 2015
    Posts:
    19
    I just bought the asset and it looks great so far! One question: I have added Data Bind support to my ListView, but I could only see some new script files (ListViewLevelCardDataSourceSetter.cs, etc) generated. What exactly are they used for, or did I miss any generated components?
     
  46. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    You should probably read Data Bind for Unity documentation.

    Tutorial:
    1. Create context script with data of the type
      ObservableList<LevelCard>
      instead of the
      string
    2. Add context holder component and specify your context.
    3. Bind value with ListViewLevelCardDataSourceSetter component
    So ListViewLevelCardDataSourceSetter used to bind the value from your context script to ListViewLevelCard.DataSource property.

    I am not the author of Data Bind so I cannot correctly describe how it's should be used.
     
    TigerHix likes this.
  47. TigerHix

    TigerHix

    Joined:
    Oct 20, 2015
    Posts:
    19
    In the scene I have the following hierarchy:

    TileViewLevelCard (The base TileView)
     - ScrollRect
      - Viewport
       - List
        - DefaultItem (The item)
         - Title (A text label)

    I followed your instructions:

    1) Created both the collection context script and the item context script:

    Code (CSharp):
    1. public class LevelGrid : Context
    2. {
    3.     private readonly Property<ObservableList<LevelCard>> itemsProperty = new Property<ObservableList<LevelCard>>();
    4.  
    5.     public LevelGrid()
    6.     {
    7.         Items = new ObservableList<LevelCard>
    8.         {
    9.             new LevelCard {Level = new Level {title = "Title1"}},
    10.             new LevelCard {Level = new Level {title = "Title2"}},
    11.             new LevelCard {Level = new Level {title = "Title3"}},
    12.             new LevelCard {Level = new Level {title = "Title4"}},
    13.             new LevelCard {Level = new Level {title = "Title5"}}
    14.         };
    15.     }
    16.  
    17.     public ObservableList<LevelCard> Items
    18.     {
    19.         get { return itemsProperty.Value; }
    20.         set { itemsProperty.Value = value; }
    21.     }
    22.  
    23. }
    Code (CSharp):
    1. using Slash.Unity.DataBind.Core.Data;
    2.  
    3. public class LevelCard : Context
    4. {
    5.     private readonly Property<Level> levelProperty = new Property<Level>();
    6.  
    7.     public Level Level
    8.     {
    9.         get { return levelProperty.Value; }
    10.         set { levelProperty.Value = value; }
    11.     }
    12.  
    13.     public string Title
    14.     {
    15.         get { return levelProperty.Value.title; }
    16.         set { levelProperty.Value.title = value; }
    17.     }
    18. }
    19.  
    (The Level class is just a data class)

    2) Added the Context Holder component to TileViewLevelCard

    upload_2019-1-28_23-34-19.png

    and DefaultItem:

    upload_2019-1-28_23-36-13.png

    3) Added the ListViewLevelCardDataSourceSetter component to TileViewLevelCard:

    upload_2019-1-28_23-34-10.png

    and TextSetter component to DefaultItem->Title:

    upload_2019-1-28_23-38-9.png

    Now if I run the scene, 5 items initialized in the LevelGrid class constructor will be populated, which is great. However, the contexts are not applied to the populated DefaultItems, so the titles are not set. Any workaround or this is a Data Bind issue?
     

    Attached Files:

  48. TigerHix

    TigerHix

    Joined:
    Oct 20, 2015
    Posts:
    19
    Also another question that comes to mind, do some UI Widgets features overlap with Data Bind? Since the ListViewComponentLevelCard also has UI binding to the text:

    upload_2019-1-28_23-47-0.png

    I would like to know what is the optimal design pattern I should use here.

    Sorry for bothering you with so many questions!
     
  49. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    Yes, UI Widgets functionality relative DefaultItems is overlapping with Data Bind:
    • DefaultItem content should be controlled with ListViewComponentLevelCard, not the Data Bind
    • binding level data for DefaultItem is optional and can be done with INotifyPropertyChanged implementation (without it DefaultItem content not be updated when you change title or level)
    You need to add Content Holder only to the TileViewLevelCard, and DefaultItem content will be controlled with TileViewLevelCard and ListViewComponentLevelCard: just specify Level field in ListViewComponentLevelCard instead of the adding Context Holder to it.

    And add INotifyPropertyChanged implementation to LevelCard if you want to modify Level or Title names in runtime:
    Code (CSharp):
    1. public class LevelCard : Context, System.ComponentModel.INotifyPropertyChanged
    2. {
    3.     private readonly Property<Level> levelProperty = new Property<Level>();
    4.  
    5.     public Level Level
    6.     {
    7.         get { return levelProperty.Value; }
    8.  
    9.         set
    10.         {
    11.             levelProperty.Value = value;
    12.             Changed("Level");
    13.         }
    14.     }
    15.  
    16.     public string Title
    17.     {
    18.         get { return levelProperty.Value.title; }
    19.  
    20.         set
    21.         {
    22.             levelProperty.Value.title = value;
    23.             Changed("Title");
    24.         }
    25.     }
    26.  
    27.     public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged = (x, y) => { };
    28.  
    29.     protected void Changed(string propertyName)
    30.     {
    31.         PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
    32.     }
    33. }
    So this part is unnecessary
     
    Last edited: Jan 29, 2019
    TigerHix likes this.
  50. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    706
    v1.10.2 released

    Changelog:
    • added ScrollbarMinSize component - allow set minimum size of the scrollbar handle
    • added DragOneDirection component - it changes drag event to work only with one direction
    • added LayoutDropIndicator component to use with TableHeader
    • added Project Settings support for Unity 2018.3 and later
    • Accordion: fixed problems when content size changed
    • Accordion: added ForceOpen() and ForceClose() functions to open and close items without animation
    • Accordion: added fields AnimationOpen, AnimationOpenFlexible, AnimationClose, AnimationCloseFlexible to change animations
    • AudioPlayer: added setter for Source property
    • LayoutSwitcher: added LayoutSelector field to control layout selection
    • ListView: added CanSelect(index) and CanDeselect(index) fields
    • ListView: added PrecalculateItemSizes, disabling this option increase performance with huge lists of items with variable sizes
    • ListView: fixed LimitScrollValue when scroll to end
    • ListView: fixed error when drag-and-drop position after the last item
    • ObservableList: added INofityPropertyChanged implementation
    • ObservableList: added ObserveItems field
    • ObservableList: now allowed null items
    • RangeSlider: now correctly works when enabled or disabled inside layout groups
    • ResizableHeader: renamed to TableHeader with related class
    • TableHeader: no more required IResizableItem implementation for the ListView.DefaultItem
    • TableHeader: added GetColumnsOrder() and SetColumnsOrder() functions
    • TableHeader: added DropIndicator support
    • Sidebar: added prefab and styles support
    • Spinner: now use InputField component instead of the inheritance
    • Spinner: added TextMesh Pro support
    • Switch: SetStatus() now does not invocate events for other Switches in the same group
    • TextMesh Pro support: widgets created with default menu “UI / New UI Widgets / …” if support enabled
    • TextMesh Pro support: removed menu “UI / UIWidgets with TextMesh Pro / …”
    • TextMesh Pro support: added menu “Edit / Project / Settings / New UI Widgets / Import TextMesh Pro support package” to import TMPro prefabs after update to new version
    • Widget Generation: added ScriptableObject support
    • Widget Generation: added Data Bind support
    • Other: fixes related using instantiate with inited complicated widgets
    • Other: “UIWidgets” in the menu replaced with “New UI Widgets” to match with the package name
    • Other: Time used with animations can be controlled with Utilites.GetTime field (You can use own Time manager instead of the default Time.time)
     
    hopeful and TigerHix like this.