FyroxEngine/Fyrox · info

Unable to load script instance of id

Error message

Unable to load script instance of id {} in new format! Trying to load in old format...

What it means

When deserializing a ScriptInstance, Fyrox first tries the 'new' serialization format by visiting the 'Data' region. If that visit fails, the script data is presumably in the legacy format, so this warning is logged and a compatibility loader for the old format is attempted. It is an expected branch when loading scenes saved by older engine versions, not a hard failure — but it indicates the asset must be re-saved.

Solutions

  1. Load the scene once, then re-save it in the current editor so scripts use the new format.
  2. Update project assets in bulk by loading and re-saving all scenes/prefabs after an engine upgrade.
  3. If loading fails entirely, inspect the script's serialized properties against the current script definition.
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: Loading a scene/prefab whose scripts were serialized with an older Fyrox version, so the 'Data' visit in the new format fails and the old-format path is used.

Common situations: Opening projects created before a script serialization format change; loading assets from an older engine release into a newer one.

Understand the failure class

Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.

Related errors


AI-assisted analysis of FyroxEngine/Fyrox@76c91aad8e (2026-09-10). Data as JSON: /api/errors/4dfb1dfef892b1f0. Report an issue: GitHub.

Appendix: source

Thrown at fyrox-impl/src/script/mod.rs:739

}

impl DerefMut for Script {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut *self.instance
    }
}

impl Visit for Script {
    fn visit(&mut self, name: &str, visitor: &mut Visitor) -> VisitResult {
        let mut region_guard = visitor.enter_region(name)?;

        // Check for new format first, this branch will fail only on attempt to deserialize
        // scripts in old format.
        if self.instance.visit("Data", &mut region_guard).is_ok() {
            // Visit flags.
            self.initialized.visit("Initialized", &mut region_guard)?;
        } else {
            Log::warn(format!(
                "Unable to load script instance of id {} in new format! Trying to load in old format...",
                self.id()
            ));

            // Leave region and try to load in old format.
            drop(region_guard);

            self.instance.visit(name, visitor)?;

            Log::warn(format!(
                "Script instance of id {} loaded successfully using compatibility loader! Resave the script!",
                self.id()
            ));
        }

        Ok(())
    }
}

View on GitHub (pinned to 76c91aad8e)