Comments (5)
Well we've got ReorderableCollection, but it's intended to be used from Custom Editors.
Here you may make custom editor for ListReorderTest and create ReorderableCollections for every collection you want to handle them the way you want.
private ReorderableCollection _reorderableSprites;
private void OnEnabled() {
var sprites = serializedObject.FindProperty(nameof(ListReorderTest.Sprites));
_reorderableSprites = new ReorderableCollection(stack);
...
}
public override void OnInspectorGUI() {
// Draw all the stuff till the last Sprites array
_reorderableSprites.Draw();
...
}
Surely in your case it's lots of work and I believe it should be easy to make approach to draw as reorderable collection with a custom type
from mybox.
But with ReorderableCollection you're able to do a lot of stuff :)!
For instance, with this example I draw array of InteractiveActions (base type for different actions with different drawers):
_reorderableItemsStack = new ReorderableCollection(stack);
_reorderableItemsStack.CustomDrawer += ActionDrawer;
_reorderableItemsStack.CustomDrawerHeight += ActionHeight;
_reorderableItemsStack.CustomAdd += CustomAdd;
_reorderableItemsStack.CustomRemove += CustomRemove;
This way I'm able to do stuff like this, with custom popup of types when you click on Add and extra logic on Remove
from mybox.
Ok I did it 😁.
You've got ReorderableArray and ReorderableList base classes to create your own collections (it's basically a wrappers for "Collection" property of Array or List type):
[Serializable]
public class ReorderableInt : Reorderable<int>
{
}
public ReorderableGameObject GOArray;
public ReorderableTransformList TransformList;
public ReorderableInt IntArray;
... // a few way to access collection
var firstElement = IntArray[0];
var lastElement = IntArray.Collection.LastOrDefault();
from mybox.
I'll update MyBox version a bit later, when'll be able to fix problem with Updater.
For now I wrote tiny instruction on easiest way to get the latest version (commit) of the package, so you may do this to get Reorderable type
from mybox.
This is so awesome! Thank you for getting back to me.
from mybox.
Related Issues (20)
- Bug: Waiting for user code in MyBox.dll to finish executing HOT 3
- Crash in MySerializedProperty
- Constant errors with conditional field
- Enter Play mode being slower after install the package HOT 5
- Release with .unitypackage HOT 1
- Naming Conflit HOT 1
- Editor takes a long time in "MyEditorEvents.OnWillSaveAssets" HOT 4
- [ButtonMethod] not work in list item
- Passing a List or Array to DefinedValues HOT 3
- ConditionalField does not work when RegexString is used on the same fields HOT 1
- Missing def for Attributes/DefinedValuesAttribute.cs HOT 1
- ConditionalFieldAttribute is rather slow HOT 3
- Suggestion: Help boxes
- Using [ConditonalField] causes Editor Button to be drawn twice HOT 2
- ReadOnly HOT 1
- "No GUI Implemented" when using a UIElement Property Drawer with Default Inspector. HOT 5
- MyEditorAudio.cs not found. HOT 1
- DefinedValues w. method is null HOT 4
- [ConditionalField] doesn't work with lists or arrays HOT 1
- Foldout doesn't work properly in child classes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mybox.