Skip to content

Commit ca5e331

Browse files
bors[bot]Lamby777
andauthored
Merge #253
253: DTC example - Don't `_process` on player in editor r=Bromeon a=Lamby777 Same bug we went over on the Discord channel. Prevents this stuff from happening in the editor: ![image](https://user-images.githubusercontent.com/35111165/235373942-9da696f3-9c9e-430e-bc71-327010524058.png) ...at least, until #70 is resolved. Then, this can be removed, since it's not necessary. Co-authored-by: Dex <[email protected]>
2 parents 0626d94 + 6ba911e commit ca5e331

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

examples/dodge-the-creeps/rust/src/player.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
use godot::engine::{AnimatedSprite2D, Area2D, Area2DVirtual, CollisionShape2D, PhysicsBody2D};
1+
use godot::engine::{
2+
AnimatedSprite2D, Area2D, Area2DVirtual, CollisionShape2D, Engine, PhysicsBody2D,
3+
};
24
use godot::prelude::*;
35

46
#[derive(GodotClass)]
@@ -58,6 +60,12 @@ impl Area2DVirtual for Player {
5860
}
5961

6062
fn process(&mut self, delta: f64) {
63+
// Don't process if running in editor. This part should be removed when
64+
// issue is resolved: https://github.com/godot-rust/gdext/issues/70
65+
if Engine::singleton().is_editor_hint() {
66+
return;
67+
}
68+
6169
let mut animated_sprite = self
6270
.base
6371
.get_node_as::<AnimatedSprite2D>("AnimatedSprite2D");

0 commit comments

Comments
 (0)