Hello guys, I'm new here; so sorry if I'm breaking a rule.

sorry for the long post, but I have to explain you all the scenario to give to you the complete situation of my problem :)

So, let me tell you the entire story.

Some user named lightsome created an awesome plugin for godot that integrates into the engine text to speech capabilities, and next to this plugin created other named godot accessibility, that adds to the engine or games created with it the possibility to give spocken output for the blind person.

The second plugin, also make the majority of the UI content accessible for the blind people (like me) so the engine is usable using different screen readers.

The unique problem if a blind person want to start from scratch to create something with godot, the first of that he needs to do, is create a new project and activate that plugin... but without that plugin the interfase isn't accessible, so. For aboid this problem, lightsome creates a small project template that we can use to have a empty project, but with the accessibility and tts features pre-loaded on it. this is the repository

https://github.com/lightsoutgames/godot-accessible-starter

So, my real problem start here.

I installed godot, version 3.2.1 mono (I want use it with c#) and follow the instructions on the template to start with it. I installed all dependencies, put the correct plugins in the add-ons template, I started my godot instance with the project and all things works fine. I can build the example provided in the template (that is with GDScript) and all things are awesome.

So, next, I create only for test a new scene with a VBoxContainer as a root Node. Add two buttons to it, and again, all works fine.

My next step, is want to add a new c# script to the root Node, to control the behavior of the project. I add it, and without modifying it, keep it with the default content, when I tried to build the project, I can't

In the console, this error appear about problems with mono:

ERROR: debug_send_unhandled_exception_error: System.InvalidCastException: Specified cast is not valid. At: modules/mono/mono_gd/gd_mono_utils.cpp:357 ERROR: call_build: An EditorPlugin build callback failed. At: editor/editor_node.cpp:5268 ERROR: debug_send_unhandled_exception_error: System.InvalidCastException: Specified cast is not valid. At: modules/mono/mono_gd/gd_mono_utils.cpp:357

I don't know what occurs here. The small hello world project using the template is here https://github.com/sanslash332/godot-accesible-example

A friend of mine get exactly the same error trying a similar example.

Maybe is a problem with the base template? with some of the accessibility plugins? or what. I talked with this with the creator of the template, but He don't use the c# version, so doesn't know if the plugin can be affected for the c# environment.

So, if someone can try to make this thing works... or can check what is the problem, I'm very happi.

This is the first game engine that isn't pure scripting that blind programmers can use; I know that it works through a plugin, but if a plugin get this, will be easy for the developers make something better to improve the godot accessibility.

thanks guys.

pd: I'm using godot 3.2.1 c#, I have visual studio 2019 installed. with .net frameworks 4.5, 4.6, 4.6.1 and 4.8 installed.

thanks soo far

Welcome to the forums @sanslash332!

I'm new here; so sorry if I'm breaking a rule.

No worries! Your post does not break any rules :smile: If you ever want to check the rules, you can find them here, but again, your post is fine.


As far as the problem goes, does a normal blank C# project work? If a blank C# project works, then that helps narrow down what is causing the problem by (mostly) eliminating the Godot core as the issue.

Based on the errors outputted by Godot, it seems to be a typecasting problem. It looks like the problem itself is with the EditorPlugin class, the plugin's hooks to the editor, and not necessarily the plugin itself. The issue really seems to be something with converting a GDScript type to a C# type, from what I can gather.

Maybe something changed with the EditorPlugin class between releases of the accessibility plugins... Though looking at the repository for the plugin, the last commit was less than a year ago, so nothing too dramatic should have changed since then. It could be a bug in the C# bindings for translating GDScript code to C# code, but I do not know enough about the process to make anything more than a speculative guess.

Are you using a 64-bit computer? The accessibility plugin notes that 32-bit machines will not work. You will also likely need to use the 64-bit version of Godot, if you are not already.

Wow! thanks @TwistedTwigleg for the fast answer!

Well, a big problem with that statement, is that if I launch godot without load the accessibility plugin (simply launch godot executable to see the main window) I can't do nothing with the program.

Godot itself isn't accessible for blind people, so if you don't load these helper tools, you can't interact with the editor using your active screen reader; so I'm attached of hands and can't create a new blank c# without the template.

And yep, I'm using a 64bit windows, with 64bit godot's mono 3.2.1, and with 64bits of jaws for windows. To clarify, JFW is my picked screen reader.

So, digging more in the problem. Can be a issue with the plugin itself, or probably is a internally issue of godots when you are converting a GDScript plugin to use with c# release.

The curious is, if I launch the template without adding any c# script (using the mono version of godot) it runs well; the problem appears after you add any empty c# script to the project, and the classic .csproj and .sln files appear next to your first .cs class.

Well, any recommendations that I can do? some ttips or issues that can give to the autor of the plugin to test?

I know that I can work using GDScript; but I really like use it with c#.

Again, thanks for your help; is greatly appreciated.

So I hope if for future versions, godot can be accessible itself without needs of a external plugin; if someone achieved this without much help, I know that the godot team can got something better :3

Again, thanks so far!

@sanslash332 said: Well, a big problem with that statement, is that if I launch godot without load the accessibility plugin (simply launch godot executable to see the main window) I can't do nothing with the program.

Godot itself isn't accessible for blind people, so if you don't load these helper tools, you can't interact with the editor using your active screen reader; so I'm attached of hands and can't create a new blank c# without the template.

Ah, that makes sense. I'm not totally sure what the issue could be, but I'll download the project real quick and see if I can deduce what might be going on. No guarantees I can get anything working, but worse case we're still were we are right now.

So, digging more in the problem. Can be a issue with the plugin itself, or probably is a internally issue of godots when you are converting a GDScript plugin to use with c# release.

The curious is, if I launch the template without adding any c# script (using the mono version of godot) it runs well; the problem appears after you add any empty c# script to the project, and the classic .csproj and .sln files appear next to your first .cs class.

Hmm, so the issue might not be the plugin itself, but rather how C# communicates with GDScript. Sounds like it could be a bug with the Mono and GDScript cross-language bindings. If that is the case, then something in the Godot core will need adjusting/fixing.

Well, any recommendations that I can do? some tips or issues that can give to the author of the plugin to test?

I know that I can work using GDScript; but I really like use it with c#.

The only thing I can think of is making an issue on the plugin, linking to a minimum reproduction project, and trying to provide any additional information if the author of the plugin needs it. If the plugin author does not know what is going on, then it might not be a bad idea to make a GitHub issue on the main Godot repository, since this could affect other plugins and may be a bug with the Mono and GDScript cross-language bindings.

Again, thanks for your help; is greatly appreciated.

So I hope if for future versions, godot can be accessible itself without needs of a external plugin; if someone achieved this without much help, I know that the godot team can got something better :3

Again, thanks so far!

Happy to help! I wish I could provide a better answer or solution though.

Some notes/changes:

In Acessible.gd, line 671, there was a bunch of errors. This is because it assumes that the first child of the focused selection will be a Node2D/Control node, which is not always the case. To fix this issue, the function needs to be changed to the following:

func editor_inspector_section_focused():
	var child = node.get_children()[0]
	var tokens = PoolStringArray(["editor inspector section"])
	
	if (child is CanvasItem or child is Spatial):
		var expanded = child.is_visible_in_tree()
		if expanded:
			tokens.append("expanded")
		else:
			tokens.append("collapsed")
	
	TTS.speak(tokens.join(": "), false)

However, this is just a minor thing and not a huge issue. I found it just made renaming the node with a double click a little difficult.

I had the same issues with Godot 3.2.1 stable C# on Windows (64-bit), so it is definitely not something that only occurs on your machine. I looked at the source code that the error points to, but didn't find anything too specific. I did, however, find after looking at the terminal that it has something to do with C# arrays.

Below is a dump of the error from the terminal:

! Unhandled Exception: ! System.InvalidCastException: Specified cast is not valid. ! at (wrapper castclass) System.Object.castclass_with_cache(object,intptr,intptr) ! at Godot.Collections.Array1[T].get_Item (System.Int32 index) [0x00017] in <b9d58775389d4928a495c2705c7eba7b>:0 ! at Godot.Collections.Array1+<GetEnumerator>d28[T].MoveNext () [0x00040] in <b9d58775389d4928a495c2705c7eba7b>:0 ! at GodotTools.BottomPanel.GetBuildTabFor (GodotTools.BuildInfo buildInfo) [0x00031] in <a780c1152e894945ab1077a5a092104b>:0 ! at GodotTools.BuildManager.Build (GodotTools.BuildInfo buildInfo) [0x0002d] in <a780c1152e894945ab1077a5a092104b>:0 ! at GodotTools.BuildManager.BuildProjectBlocking (System.String config, System.Collections.Generic.IEnumerable`1[T] godotDefines) [0x00166] in <a780c1152e894945ab1077a5a092104b>:0 ! at GodotTools.BottomPanel.BuildProjectPressed () [0x00086] in <a780c1152e894945ab1077a5a092104b>:0 ! at GodotTools.GodotSharpEditor._BuildSolutionPressed () [0x0001f] in <a780c1152e894945ab1077a5a092104b>:0 ! ERROR: debug_send_unhandled_exception_error: System.InvalidCastException: Specified cast is not valid. ! At: modules/mono/mono_gd/gd_mono_utils.cpp:371

Looking at the error, it seems to be something internal and an issue with the Mono build of C#. I'm not quite sure what is causing the issue just yet, but the error log at least can help pin down what could be causing the issue. Unfortunately, I don't really have the time to do a deeper dive right now into the issue, but this at least suggests that the issue is on the Mono side of Godot, and that perhaps the plugin is triggering the issue, but is not directly the issue.

Again, thanks @TwistedTwigleg for your valuable help.

Well, apparently as you says, is a internally problem with the mono part of the godot, but... How reports this on the github?

Exactly, what is the report that I have to do? the complete story is... a few long to post directly on the github, so...

IS a cross binding language issue?

Or... what.

I will try the project, but using a previous godot mono release; maybe is a issue introduced in the lasts versions.

Again, thanks for all!

OK @TwistedTwigleg A interesting discover

I tested my problem with the upcoming godot 3.2.2, using the beta3 mono version, and noup. the problem occurs again. So, I tried going before, and interesting; in version 3.1.2 the problem didn't appear and you can compile without problems the project.

So, starting from version 3.2_stable the problem appear and isn't buildable, but with previous versions it works.

With that I have more things to report hmmm...

Again, thathanks for your feedback :3

A, and sorry for the doble post!

Hmmm thanks

a month later
2 years later