Closed EstevanBR closed 2 months ago
@Maxim-Lanskoy regarding:
Removing .gdextension file from Packer excludes helps, but then types are imported twice, just as you've said. I have another project, where I've made setup by following tutorial from SwiftGodot documentation site and do not facing this issue there. But I can not find differences in setup which are causing this.
I will look into this, for what it's worth I see this error too, but for me, it's not actually causing any issues; my project still runs, and my types still work, and resources are still available.
So I just want to double check the severity of this issue you are seeing?
And to summarize it seems:
if we don't exclude the .gdextension file in the .pck export, the error goes away, but types are registered twice. (this also means including the .dylib / .a / .so files twice which can really bloat the size of the executable). If we do exclude it, we see an error, and AFAIK the error does not actually break anything.
It works for me too, even with error, but it's better to not have error at all 😅 Sorry for focusing on non-critical issue.
it's better to not have error at all 😅
👍🏻 👍🏻
Sorry for focusing on non-critical issue.
No need to apologize, I just wanted to make sure I wasn't ignoring a severe problem.
I appreciate your feedback. 🙏🏻 Thanks for taking the time.
I've tried the following:
ERROR: Failed loading resource: res://Name.gdextension. Make sure resources have been imported by opening the project in the editor at least once.
ERROR: Attempt to register extension class 'Icon2D', which appears to be already registered.
And everything seems to work. 🤔 Which surprises me because a while back, doing 2 would cause some odd issues with type casting / lookups.
Also the resulting .pck file was quite small 28KB which obviously does not include the .dylib files, libSwiftGodot is ~97MB
I'm going to test this a bit more, but it seems like this issue might be able to be resolved with a couple lines.
resolved by #9
Am I correct that I need to comment out registerTypes
line when running from make run
or launching Xcode executable target? And uncomment when building or running pack command?
Am I correct that I need to comment out registerTypes line when running from make run or launching Xcode executable target? And uncomment when building or running pack command?
Hmm. No. My expectation is that you can leave that commented out, especially during building (make all
) and make pack
But if you're seeing different behaviors or issues, please LMK 👍🏻
For example If you have trouble type casting:
// if you know for a fact that node has a child of type MyNode2D
guard let node2d = node.getChild("MyNode2D") as? MyNode2D else {
// but the cast fails...
}
and the cast above fails, but you expect it should work because you've registered the type, then I'd recommend uncommenting the registerTypes call in the executableTarget (main.swift)
I left the #warning("uncomment this line if type casting / lookups don't work")
there in case users run in to the same problem I did a while back:
Miguel was helping me debug an issue where type lookups (and casting) were not working because I was only registering types once, in the libraryTarget, but I wasn't registering them again in the executableTarget, I made this mistake because:
So despite registering twice (once in the library, and again in the executable) causing an error to appear in the logs, that was the fix at the time.
But based on my more recent testing this week, I suspect it's been fixed, such that registering the types in the library alone seems sufficient.
But if you run into any issues let me know.
So yeah,
make
commands are now passing correctly. Renaming executable also works like a charm. But I'm still having issues when runningmake run
or launch executable target in Xcode.Removing
.gdextension
file from Packer excludes helps, but then types are imported twice, just as you've said. I have another project, where I've made setup by following tutorial from SwiftGodot documentation site and do not facing this issue there. But I can not find differences in setup which are causing this.Originally posted by @Maxim-Lanskoy in https://github.com/EstevanBR/SwiftGodotKick/issues/3#issuecomment-2277843040