paulloz/godot-ink

Invalid cast

Closed this issue · 3 comments

Getting these errors when loading ink script in "ink preview", after installing and enabling:

modules/mono/glue/runtime_interop.cpp:1303 - System.InvalidCastException: Unable to cast object of type 'Godot.Resource' to type 'GodotInk.InkStory'.
     at Godot.ResourceLoader.Load[T](String path, String typeHint, CacheMode cacheMode) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/ResourceLoaderExtensions.cs:line 27
     at Godot.GD.Load[T](String path) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs:line 128
     at GodotInk.InkDock.LoadStory(String path) in R:\--\addons\GodotInk\Src\InkDock.cs:line 88
     at Godot.EditorFileDialog.FileSelectedTrampoline(Object delegateObj, NativeVariantPtrArgs args, godot_variant& ret) in /root/godot/modules/mono/glue/GodotSharp/GodotSharpEditor/Generated/GodotObjects/EditorFileDialog.cs:line 431
     at Godot.DelegateUtils.InvokeWithVariantArgs(IntPtr delegateGCHandle, Void* trampoline, godot_variant** args, Int32 argc, godot_variant* outRet) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs:line 47

Btw, this download link isn't working anymore: https://codeload.github.com/paulloz/godot-ink/zip/refs/heads/godot-v4
So I just cloned the repo and copied the addons folder to my own project.

Environment

  • OS: Windows
  • Godot version: v4.0.2.stable.mono.official [7a0977ce2]
  • godot-ink version: godot-v4
  • ink version: latest?

Hi 👋

Getting these errors when loading ink script in "ink preview", after installing and enabling:

My first guess would be you haven't actually imported your ink file correctly: see Is Main Story in the documentation.

Btw, this download link isn't working anymore: https://codeload.github.com/paulloz/godot-ink/zip/refs/heads/godot-v4

That's normal. The branch you're linking to doesn't exist any more, since the Godot 4 version now lives on main. I'm updating the link in the quick start guide. I imagine you got that link over there?

I added a more explicit error message here.

That was it... Thanks for the quick reply.

Yes I got the link from here: https://github.com/paulloz/godot-ink/wiki#%EF%B8%8F-installation, it's also working now.