Godot-cpp - Godot editor constantly outputing InputMap errors

Godot Version

v4.6.3.stable.official

Question

Hi all,

I wrote my player controller using godot-cpp, compiled it, and now the editor is throwing a fit that my input actions don’t exist (even though they exist in Project Settings > Input Map).

I assume that when I compile my C++ code, the editor immediately tries to look for these actions? I read somewhere that I would need
Code snippet below. Code is from a tutorial but I rewrote it in C++.

Thanks guys!


Vector2 inputDir = Input::get_singleton()->get_vector("move_left", "move_right", "move_forward", "move_backward");
	Basis basis = get_basis();
	direction = UtilityFunctions::lerp(
		direction,
		(basis.xform(Vector3(inputDir.x, 0, inputDir.y))).normalized(),
		delta * walkLerpSpeed
	);

	Vector3 velocity = get_velocity();
	if (direction != Vector3())
	{
		velocity.x = direction.x * currentSpeed;
		velocity.z = direction.z * currentSpeed;
	}
	else
	{
		velocity.x = UtilityFunctions::move_toward(direction.x, 0, currentSpeed);
		velocity.z = UtilityFunctions::move_toward(direction.z, 0, currentSpeed);
	}

	move_and_slide();
```

GDExtension nodes run in the editor too and the editor has its own input map. You need to guard the functions that will only run at runtime like:

void Player::_physics_process(double delta) {
    if (Engine::get_singleton()->is_editor_hint()) {
        return;
    }
    
    // player code
}

Thanks, mrcdk, this works