FyroxEngine / Fyrox

3D and 2D game engine written in Rust
https://fyrox.rs
MIT License
7.64k stars 343 forks source link

Scripts return a DirectlyInheritableEntity Is not satisfied error. #358

Closed BeyondTomrrow closed 2 years ago

BeyondTomrrow commented 2 years ago

When following along the blog post for 0.27 you will get an impl ScriptTrait for Example { | ^^^^^^^^^^^ the trait `DirectlyInheritableEntity` is not implemented for `Example'

This also occurs with fyrox-template script --name example command to generate the template.

Is there a current workaround?

mrDIMAS commented 2 years ago

This is known and happens when using latest engine and "outdated" tutorials. You can implement the trait using following macro:

use fyrox::{scene::DirectlyInheritableEntity, impl_directly_inheritable_entity_trait};
...
 impl_directly_inheritable_entity_trait!(YourScript;)
mrDIMAS commented 2 years ago

Keep in mind, that this trait (and macro) was removed in inheritance branch. It will be merged to master quite soon.

BeyondTomrrow commented 2 years ago

Thank you for the quick response and for the fix.