1 Star 0 Fork 0

唯粉/Unity-Reorderable-List

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Reorderable List

An attempt to mimic the ReorderableList within Unity while adding some extended functionality.

screenshot

Installation

This extension can be installed using Unity package manager.
https://github.com/cfoulston/Unity-Reorderable-List.git

  • Package manager UI

    screenshot

  • Manifest

      {
      	"dependencies": {
      		"com.malee.reorderablelist": "https://github.com/cfoulston/Unity-Reorderable-List.git"
      	}
      }
    
  • A standalone version is available under the standalone branch, although this version is no longer maintained.

Features

  • Drag and Drop references (like array inspector)
  • Expandable items and list itself
  • Multiple selection (ctrl/command, shift select)
  • Draggable selection
  • Context menu items (revert values, duplicate values, delete values)
  • Custom attribute which allows automatic list generation for properties*
  • Event delegates and custom styling
  • Pagination
  • Sorting (sort based on field, ascending and descending)
  • Surrogates (Enable adding elements of a different type)

Usage

There are two ways to use the ReorderableList

  1. Create a custom Editor for your class and create a ReorderableList pointing to your serializedProperty
  2. Create custom list class which extends from ReorderableArray, assign [Reorderable] attribute above property (not class).

Pagination

Pagination can be enabled in two ways:

  1. With the [Reorderable] attribute:
    • [Reorderable(paginate = true, pageSize = 0)]
  2. Properties of the ReorderableList:
    • list.paginate
    • list.pageSize

pageSize defines the desired elements per page. Setting pageSize = 0 will enable the custom page size GUI

When enabled, the ReorderableList GUI will display a small section below the header to facilitate navigating the pages

pagination

NOTE

Elements can be moved between pages by right-clicking and selecting "Move Array Element"

Surrogates

Surrogates can be created to facilitate adding Objects to a ReorderableList that don't match the ReorderableList type. This can be achieved in two ways:

  1. With the [Reorderable] attribute:
    • [Reorderable(surrogateType = typeof(ObjectType), surrogateProperty = "objectProperty")]
  2. Property of the ReorderableList:
    • list.surrogate = new ReorderableList.Surrogate(typeof(ObjectType), Callback);

Check the SurrogateTest and SurrogateTestEditor examples for more information

MIT License Copyright (c) 2017 Chris Foulston Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

?????????? 展开 收起
README
MIT
取消

发行版

暂无发行版

贡献者

全部

语言

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/weifen/Unity-Reorderable-List.git
git@gitee.com:weifen/Unity-Reorderable-List.git
weifen
Unity-Reorderable-List
Unity-Reorderable-List
master

搜索帮助