nathanhoad / godot_dialogue_manager

A powerful nonlinear dialogue system for Godot
MIT License
2.04k stars 161 forks source link

Fix C# mutation handling derived types in args #586

Closed SkeirBoreal closed 3 months ago

SkeirBoreal commented 3 months ago

updated ResolveThingMethod() to check if the args is assignable from a derived type. This should allow passing through any custom type as a parameter into a mutation in the dialogue. (this mainly aims at fixing methods that return a Task)

Fixes this issue: `E 0:00:02:0901 object System.Convert.ChangeType(object, System.Type, System.IFormatProvider): System.InvalidCastException: Object must implement IConvertible. <C++ Error> System.InvalidCastException <C++ Source> :0 @ object System.Convert.ChangeType(object, System.Type, System.IFormatProvider)

:0 @ object System.Convert.ChangeType(object, System.Type, System.IFormatProvider) DialogueManager.cs:181 @ void DialogueManagerRuntime.DialogueManager+d__36.MoveNext() :0 @ void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() :0 @ void System.Threading.Tasks.Task+<>c.b__128_0(object) GodotSynchronizationContext.cs:51 @ void Godot.GodotSynchronizationContext.ExecutePendingContinuations() GodotTaskScheduler.cs:76 @ void Godot.GodotTaskScheduler.Activate() ScriptManagerBridge.cs:82 @ void Godot.Bridge.ScriptManagerBridge.FrameCallback()`