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

Can't Use Interfaces as a [Property]. #65

Open
Fortune117 opened this issue Nov 16, 2023 · 5 comments
Open

Can't Use Interfaces as a [Property]. #65

Fortune117 opened this issue Nov 16, 2023 · 5 comments

Comments

@Fortune117
Copy link
Contributor

I want to set up some code to work like this:

	[Property]
	public IDamageable DamageableProxy { get; set; }

And then be able to assign any component that has the correct interface.

However, the entry bar is greyed out and doesn't work atm.
image

@garrynewman
Copy link
Member

We should make it work, but should we assume that all interfaces are going to be components? I guess we need an attribute to describe the type

@Fortune117
Copy link
Contributor Author

I can imagine using something like this for resource files as well, so a more generic solution is probably the way to go.

@garrynewman
Copy link
Member

I don't know how it could be a generic solution though. It needs to restore that property somehow when the scene is loaded, so it needs to know where to look to find the class, it can't just be any type of class.

@Fortune117
Copy link
Contributor Author

Maybe an interface on the classes it's intended to support? I think at least BaseComponent and GameResource should be explicitly supported if it can't support every class.

Possibly prefabs as well but then it starts getting a little messy.

@DrakeFruit
Copy link

kinda unrelated but being able to create your own [Property] widgets could potentially be useful? I can't think of any situations where a custom UX for a certain data type would be useful but I'm not that far in my dev journey yet. Anyone have some ideas?

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

3 participants