Skip to content

Add init_resource_with_descriptor #15448

@MichalGniadek

Description

@MichalGniadek

What problem does this solve or what need does it fill?

I'm making a scripting language and I would like to be able define resources from it dynamically. I can already do this with components by calling init_component_with_descriptor with a ComponentDescriptor::<Box<dyn PartialReflect>> but there is no equivalent for resources.

What solution would you like?

Add init_component_with_descriptor

  • takes in ComponentDescriptor
  • a unique ComponentId should be returned for each call

What alternative(s) have you considered?

I have a Wrapper(Box<dyn PartialReflect>) and I call let id = init_resource::<Wrapper>(); remove_resource_by_id(id) but that doesn't allow for multiple resources with the same underlying type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions