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
UiWidget
actually can't be added to anEntity
directly, as it's meant to be loaded through thePrefab
You have to create
UiTransform
,UiText
or one of the few otherStruct
fromamethyst::ui
that implementsComponent
and add them to anEntity
You can find more information on how to do that in the Amethyst book under the User Interface section.