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

List of base class does not draw the inheritance attributes #32

Open
RotcivOcnarb opened this issue Feb 24, 2021 · 1 comment
Open

List of base class does not draw the inheritance attributes #32

RotcivOcnarb opened this issue Feb 24, 2021 · 1 comment

Comments

@RotcivOcnarb
Copy link

Have I written this title correctly?

Suppose I have a class Prize, and I want to make a Reorderable List for it.
image
Now I have different types of Prizes that each has its own class that inherits from Prize, for example CoinPrize, that besides having the original attributes, also have a amount attribute, that I want to also modify in the inspector.

Since obviously you can't add items to the list and expect the class to magically know what type of item you want, I have create separated buttons, each that adds a specific class child for the list
image

But in the inspector, even if adding the element via the correct button, the child class attributes doesn't show up:

image

Is there any way I can make this work?

@cfoulston
Copy link
Owner

I believe you need to use the new [SerializeReference] attribute on your list.
What happens if you remove the Reorderable list? Does the functionality of adding and drawing different prizes into the list work?

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