pub trait Script {
// Provided methods
fn start(&mut self, _ctx: &mut Ctx<'_>) { ... }
fn update(&mut self, _ctx: &mut Ctx<'_>) { ... }
fn fixed_update(&mut self, _ctx: &mut Ctx<'_>) { ... }
fn fields(&mut self) -> Vec<Field<'_>> { ... }
}Expand description
Implement this (plus Default) and list the type in register_scripts!.
Public fields are exposed in the editor by returning them from fields().
Provided Methods§
Sourcefn start(&mut self, _ctx: &mut Ctx<'_>)
fn start(&mut self, _ctx: &mut Ctx<'_>)
Called once before this instance’s first gameplay callback.
A hot reload creates a new instance and calls start again.
Sourcefn update(&mut self, _ctx: &mut Ctx<'_>)
fn update(&mut self, _ctx: &mut Ctx<'_>)
Called once per accepted simulation frame before fixed physics steps.
Sourcefn fixed_update(&mut self, _ctx: &mut Ctx<'_>)
fn fixed_update(&mut self, _ctx: &mut Ctx<'_>)
Called before every fixed physics step (60 Hz by default). Apply forces here.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".