-
-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input signletone returns incorrent instance pointer #767
Comments
I don't think Godot supports this directly. From
|
@Bromeon so, then it gives two different inputs for tool and non-tool, right? I just use this annotation to show warnings on node. As I get it's not correct way. Then maybe you know how to do it better? |
I don't know about it, but I don't think this behavior is specific to Rust. I would recommend asking on the Godot forum or the Contributors chat. There's probably not much we can do on godot-rust side, as such I'll close this. Feel free to continue the discussion and share findings though! 🙂 |
@tool
extends Node
func _ready():
var actions = InputMap.get_actions()
print("====== gd start ======")
for action in actions:
print("Action: ", action)
print("====== gd end ======") it shows actions correctly, not like Rust version |
So, my research has been leaded me to next one: For example: fn physics_process(&mut self, delta: f64) {
if Engine::singleton().is_editor_hint() {
return;
}
let input = Input::singleton();
let direction = input.get_vector(
"move_left".into(),
"move_right".into(),
"move_down".into(),
"move_up".into(),
);
if direction.is_zero() {
return;
}
godot_print!("Direction: {:?}", direction.normalized());
} With this checker, you can control where is your code will be executed. |
GDExtension editor plugins work differently from GDScript ones. Additionally, in godot-rust we have changed the way how |
I haven't check 4.3 yet, my project on 4.2 |
I hit the same issue and found a solution: InputMap.load_from_project_settings() full credit to https://www.reddit.com/r/godot/comments/194l8dc/comment/khgv4hw/ |
Related: #132 (comment) 🙂 |
Hello 👋
I've found defferent behaviour when you use Input and InputMap with
tool
annotation and without.So if you will use such:
It works fine. But if you add
tool
:then you get incorrect action list and physics_process spam with error, that these actions are not defined:
Of course it's not true. Seems it's UB.
I've attach reprocase. There is two scenes:
main
- that works correctly, andcorrupted
that contains this issue.godot_reprocase.zip
The text was updated successfully, but these errors were encountered: