Skip to content

boris-741/WrapContent

Repository files navigation

Wrap Content

Example for creating GUI elements using LeoECS and Unity3d

thanks leo GitHub Pages

screenshot_0 screenshot_1 screenshot_2

  1. create data structure. example:
public struct CustomWrapItemData
{
    public string str;
}
  1. create an inheritor class from MonoBehaviour and override interface IBaseItem functions this is for scroll item element
public class WrapItem : MonoBehaviour, IBaseItem<CustomWrapItemData>
{
    public int index{set; get;} 
    public void SetData(int index, ref T data){}
    public void SetSize(float size){}
    public void SetAction(ViewAction action){}
    public void SetAction(float tm_action, float tm_cur, ViewAction action){}
    public void Show(bool show){}
}
  1. create an inheritor class from BaseWrapContent - this is scroll class GetItemSize - return size of scroll item
public class CustomWrapContent:  BaseWrapContent<CustomWrapItemData, WrapItem>
{
    protected override float GetItemSize(CustomWrapItemData data)
    {
        return 60f;
    }
}

see scene example

About

Unity Infinitie Scroll example

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages