Imagine I've created a container
let created = UiWidget::Container::<NoCustomUi, String, ()> {
transform: UiTransformData::default(),
background: None,
children: Vec::new(),
};
How do I add it to the world and get its entity back? Something like:
let entity = world
.create_entity()
.with(container)
.build();
But it says "the trait specs::world::comp::Component is not implemented for amethyst_ui::prefab::UiWidget<amethyst_ui::prefab::NoCustomUi, std::string::String>".
I'm using Amethyst v0.15
UiWidgetactually can't be added to anEntitydirectly, as it's meant to be loaded through thePrefabYou have to create
UiTransform,UiTextor one of the few otherStructfromamethyst::uithat implementsComponentand add them to anEntityYou can find more information on how to do that in the Amethyst book under the User Interface section.