943 | // Syntax: [ghost freq=5.0 span=10.0][/ghost] | ||
944 | |||
945 | // Define the tag name. | ||
946 | public string bbcode = "ghost"; |
We should make this a constant, and it probably doesn't need to be public. Although I don't see this being used at all.
public string bbcode = "ghost"; | |
private const string Bbcode = "ghost"; |
It seems to be magic - not sure how it exactly needs to be defined to be read in C# but in GDScript it just is a variable named bbcode
:
https://docs.godotengine.org/en/stable/classes/class_richtexteffect.html
This has to be tested / check RichTextEffect source code in godot.
Ah, I see. It looks like this only works with scripts that have a property named exactly bbcode
:
That's a weird pattern, I don't think we usually do that. For example, in editor plugins there are virtual methods for doing this kind of thing (e.g.: EditorPlugin::_get_plugin_name
).
So to make this work the member would have to be named bbcode
even though that goes against our C# naming conventions. And it can't be a constant.
Thank you, @raulsntos, for the code corrections you've provided! I've applied all of them to the examples.
Thanks once again for the providing all these adjustments, @raulsntos! I've applied them all.
You should probably try following the tutorial here and see if the effect actually works as expected, especially for things like the bbcode string since it seems to be a very weirdly handled thing.
I've created a C# script to test out the matrix effect code provided in this PR, but I wasn't able to load this custom effect — it didn't show up in the inspector. On the other hand, I created a script called RichTextGhost.gd
using the GDScript code provided in the tutorial, and it worked properly. I was able to load and use it.
Do you guys have any idea of what could be the problem?
You have to use the [GlobalClass]
attribute to get C# classes to show up in the inspector, it's somewhat equivalent to GDScript's class_name
.
Then it's probably a misconfiguration with my Godot. I've tried it on two different devices (both with the .NET 6.0 SDK (v6.0.423) - Windows x64
installed) but still I wasn't able to use the C# version of these custom effects, not even was able to load them in the inspector using the [GlobalClass]
.
I've used v4.3.dev5.mono.official [89f70e98d]
and v4.2.2.stable.mono.official [15073afe3]
.
Did you compile the C# solution?
913 | 913 | ||
914 | :: | ||
915 | |||
914 | .. tabs:: | ||
915 | .. code-tab:: gdscript GDScript | ||
916 |
No space, rather than deleting the line, GitHub doesn't allow that clearly
I don't get it, you suggested to delete the line between the code-tab and the code itself?
932 | 933 | return true | |
933 | 934 | ||
935 | .. code-tab:: csharp | ||
936 |
Same here
Login to write a write a comment.
What I did
Closes: #9334