private static void SendToScriptDebugger(Exception e) { var globalFrames = new List <StackInfoTuple>(); var excMsg = new StringBuilder(); CollectExceptionInfo(e, globalFrames, excMsg); string file = globalFrames.Count > 0 ? globalFrames[0].File ?? "" : ""; string func = globalFrames.Count > 0 ? globalFrames[0].Func : ""; int line = globalFrames.Count > 0 ? globalFrames[0].Line : 0; string errorMsg = "Exception"; using godot_string nFile = Marshaling.ConvertStringToNative(file); using godot_string nFunc = Marshaling.ConvertStringToNative(func); using godot_string nErrorMsg = Marshaling.ConvertStringToNative(errorMsg); using godot_string nExcMsg = Marshaling.ConvertStringToNative(excMsg.ToString()); using DebuggingUtils.godot_stack_info_vector stackInfoVector = default; stackInfoVector.Resize(globalFrames.Count); unsafe { for (int i = 0; i < globalFrames.Count; i++) { DebuggingUtils.godot_stack_info *stackInfo = &stackInfoVector.Elements[i]; var globalFrame = globalFrames[i]; // Assign directly to element in Vector. This way we don't need to worry // about disposal if an exception is thrown. The Vector takes care of it. stackInfo->File = Marshaling.ConvertStringToNative(globalFrame.File); stackInfo->Func = Marshaling.ConvertStringToNative(globalFrame.Func); stackInfo->Line = globalFrame.Line; } NativeFuncs.godotsharp_internal_script_debugger_send_error(nFunc, nFile, line, nErrorMsg, nExcMsg, p_warning: godot_bool.False, stackInfoVector); } }
public static Object EngineGetSingleton(string name) { using godot_string src = Marshaling.ConvertStringToNative(name); return(UnmanagedGetManaged(NativeFuncs.godotsharp_engine_get_singleton(src))); }
public static godot_variant CreateFromSignalInfo(SignalInfo from) => CreateFromSignalTakingOwnershipOfDisposableValue( Marshaling.ConvertSignalToNative(from));
public static godot_variant CreateFromString(string?from) => CreateFromStringTakingOwnershipOfDisposableValue(Marshaling.ConvertStringToNative(from));
public static godot_variant CreateFromCallable(Callable from) => CreateFromCallableTakingOwnershipOfDisposableValue( Marshaling.ConvertCallableToNative(from));