Giter Club home page Giter Club logo

Comments (4)

KoBeWi avatar KoBeWi commented on August 15, 2024 2

When project is opened, Godot scans the filesystem and updates class cache. It's been made much more reliable recently. Previously some scripts could be missed because the scan was buggy.

You can add .gdignore file to your folder if you want to keep files, but have them ignored.

from godot.

HolonProduction avatar HolonProduction commented on August 15, 2024

The problem is, that class_name classes that inherit node, get an entry in the create node dialogue. Also they could be used in every other script by their class name. In those cases there is no way to know which of your two scripts with the same class name is meant. Therefore class_names have to be unique across all scripts.

The class names are a unique identifier for a script so we need to know which script is meant, only given a class name. (Note, how this decision would have to be made before we could even say which scripts will run.)

Furthermore, we can't know which scripts are run with 100% certainty, since you can always use load to dynamically load and run a script. (Comes down to the halting problem. This could only be analyzed for a subset of all possible scripts, we can't rely on it therefore)

from godot.

SeanRamey avatar SeanRamey commented on August 15, 2024

The problem is, that class_name classes that inherit node, get an entry in the create node dialogue. Also they could be used in every other script by their class name. In those cases there is no way to know which of your two scripts with the same class name is meant. Therefore class_names have to be unique across all scripts.

The class names are a unique identifier for a script so we need to know which script is meant, only given a class name. (Note, how this decision would have to be made before we could even say which scripts will run.)

Furthermore, we can't know which scripts are run with 100% certainty, since you can always use load to dynamically load and run a script. (Comes down to the halting problem. This could only be analyzed for a subset of all possible scripts, we can't rely on it therefore)

I see, but can you explain why this was previously not a problem in Godot 4.1.4? Was that just a bug?

from godot.

dalexeev avatar dalexeev commented on August 15, 2024

Unused scripts are not fully loaded, but the editor checks their class_names and registers them with the ScriptServer. Then, when loading a script with the same class_name, GDScript generates an error.

from godot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.