Kiamo2 / YATI

Addon to import Tiled maps into Godot 4
MIT License
140 stars 16 forks source link

GDScript Installation fails with Class "CustomTypes" hides a global script class #46

Closed Nebelun closed 2 weeks ago

Nebelun commented 4 months ago

Describe the bug Following the instructions on installation from the readme, I downloaded v1.6.7-gdscript.zip and extracted the addons folder to the root of my projects. ./assets/YATI However attempting to enable the plugin is met with:

res://addons/YATI/CustomTypes.gd:24 - Parse Error: Class "CustomTypes" hides a global script class.
  res://addons/YATI/Importer.gd:-1 - Compile Error: 
  res://addons/YATI/TiledImport.gd:-1 - Compile Error: 
  modules/gdscript/gdscript.cpp:2788 - Failed to load script "res://addons/YATI/TiledImport.gd" with error "Compilation failed". (U

To Reproduce Steps to reproduce the behavior:

  1. In a new godot project install the YATI Addon

Expected behavior Plugin to enable correctly

Desktop (please complete the following information):

Kiamo2 commented 4 months ago

Occasionally I also had this and after some disabling and re-enabling of the plugin the problem disappeared. Don't know why that happens and unfortunately I have no clearer recipe against it. Hope you get it sorted.

Nebelun commented 4 months ago

Looks like preload seems to cause a global namespace issue. I put in a pr that has fixed it in my project. Would love it you take a look.

Kiamo2 commented 4 months ago

What happens if you now (after it once worked in the project) change that back to 'preload'? Does it continue to work or is it starting to fail again? I'm a little hesitant to change something that works for 99.9% of all users.

Nebelun commented 4 months ago

After changing it back the error comes back and refuses to load the script again. I totally get the hesitation for it and don't mind if the pr is earmarked or rejected. Just wanted to share the fix that I found.

Kiamo2 commented 4 months ago

Ok, if the error occurs again, it really is a nuisance. I'll test that and eventually include it in a future release with adaptions for 4.3. Thank you very much for your valuable hints and pr!

Kiamo2 commented 2 weeks ago

Should be now fixed with release 1.6.8 / 2.0.0