where do I start with these run-time errors with my exported project?
Asked Answered
M

4

0

Version 3.5.3 on Windows 11.
This is a complicated project to recreate an old point and click game engine, which means it's modular and scriptable (and therefore a lot harder to troubleshoot since I can't just hard-code what I want). It runs fine in the editor but the exported version gives me the below error.
It's REALLY hard to chop down to a minimally viable set of code, especially since I have to export then run with -verbose every time I remove code, so I'm hoping somebody can say something like 'you get those kinds of errors because etc...'
Unfortunately since the error is inside Godot I can't interpret what the problem is. I understand References as a class of objects that are kept track of the number of copies. I DO
thanks
(Some context: a set of subfolders exist, each one describes a game location. A 'script.gd' in each folder describes relevant images and custom code particular to that location. Because the game developer's scripting can be anything, I can't hard-code everything.)
This piece of my code may be the issue? I preload most everything else but I don't want to customize everything since that kind of breaks the design of the original game-engine.

        var nodescript = load(g.scriptpath)
	var a = nodescript.new()
Loading resource: res://N0314_closeup_phone/Script.gdc
ERROR: Script inherits from native type 'Reference', so it can't be instanced in object of type 'Node2D'.
   at: (modules/gdscript/gdscript.cpp:312)
Menjivar answered 19/2 at 6:27 Comment(0)
E
0

Menjivar Looks like you're trying to set a script that inherits from Reference to a node object. This won't work as Reference is not an ancestor class of any node type.

Estranged answered 19/2 at 10:39 Comment(0)
M
0

The question is, how is my script inheriting from a Reference class and why isn't it causing a problem running in the IDE?
The script 'extends' either Node2D or Spatial so I have no idea where this error is coming from.

Menjivar answered 19/2 at 21:19 Comment(0)
M
0

Menjivar
I fixed the problem. Since my script name is being used in multiple locations at the same time, I chose to .duplicate() my script before attaching it. I just used the original script and it still works as intended so not sure how I thought it was needed in the past. Don't know why this worked in IDE but not an export but oh well, whatever works.

Menjivar answered 19/2 at 21:54 Comment(0)
E
0

Menjivar Scripts inherit Reference by default if no extends class is specified. Look if there are any such scripts in your project.
Also let's actually see the resource file that error is complaining about: Script.gdc

Estranged answered 19/2 at 21:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.