Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReorderableList and ShowAssetPreview do not work together #123

Closed
orangy opened this issue Feb 21, 2020 · 2 comments
Closed

ReorderableList and ShowAssetPreview do not work together #123

orangy opened this issue Feb 21, 2020 · 2 comments

Comments

@orangy
Copy link

orangy commented Feb 21, 2020

Add this code to ReorderableListTest and try to drop a prefab into the list.

		[ReorderableList]
		[ShowAssetPreview]
		public List<GameObject> prefabList;

It doesn't work and throws NRE.

@dbrizov
Copy link
Owner

dbrizov commented Mar 1, 2020

I know. Unity's CustomPropertyDrawers target each element of arrays. ReorderableList however is implemented with a custom solution and it targets the arrays themselves. This is the reason why it's not working. A workaround is to have something like this:

[ReorderableList]
public List<PrefabWrapper> prefabList;

[Serializable]
public struct PrefabWrapper
{
    [ShowAssetPreview]
    public GameObject prefab;
}

I know it's not pretty, but this is the best solution I can think of.
I'll fix the exception, and log an error, but I won't be able to fix the behavior.

@dbrizov
Copy link
Owner

dbrizov commented Aug 9, 2020

Fixed in 693dffb

The 2 attributes can actually be combined. The problem is that it works only with the default width and height of the [ShowAssetPreview] attribute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants