Skip to content

Commit

Permalink
Import symbols used in version check (through macro)
Browse files Browse the repository at this point in the history
This fixes an issue for users without `use gdnative::prelude::*`, which could run into
an error regarding symbols not found (e.g. Variant).
  • Loading branch information
Bromeon committed Oct 2, 2022
1 parent 8ed2e11 commit 443901d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gdnative-core/src/init/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ macro_rules! godot_nativescript_init {
// Compatibility warning if using in-house Godot version (not applicable for custom ones)
#[cfg(not(feature = "custom-godot"))]
{
use $crate::core_types::Variant;

let engine = gdnative::api::Engine::godot_singleton();
let info = engine.get_version_info();

if info.get("major").expect("major version") != Variant::new(3)
|| info.get("minor").expect("minor version") != Variant::new(5)
|| info.get("patch").expect("patch version") < Variant::new(1) {
let string = info.get("string").expect("version str").to::<String>().expect("version str type");
gdnative::log::godot_warn!(
$crate::log::godot_warn!(
"This godot-rust version is only compatible with Godot >= 3.5.1 and < 3.6; detected version {}.\n\
GDNative mismatches may lead to subtle bugs, undefined behavior or crashes at runtime.\n\
Apply the 'custom-godot' feature if you want to use current godot-rust with another Godot engine version.",
Expand Down

0 comments on commit 443901d

Please sign in to comment.