ScriptBacktrace
A captured backtrace of a specific script language.
A captured backtrace of a specific script language.
ScriptBacktrace holds an already captured backtrace of a specific script language, such as C# or C#, which are captured using Engine.CaptureScriptBacktraces.
See ProjectSettings.debug/settings/csharp/always_track_call_stacks and ProjectSettings.debug/settings/csharp/always_track_local_variables for ways of controlling the contents of this class.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
ScriptBacktraceConstructor
public ScriptBacktrace();Methods16
Formatstring
public string Format(int indentAll = 0, int indentFrames = 4);Converts the backtrace to a string, where the entire string will be indented by indent_all number of spaces, and the individual stack frames will be additionally indented by indent_frames number of spaces.
Note: Calling ReckfellObject.ToString on a ScriptBacktrace will produce the same output as calling ScriptBacktrace.Format with all parameters left at their default values.
| Name | Type | Default |
|---|---|---|
indentAll | int | 0 |
indentFrames | int | 4 |
stringGetFrameCountint
public int GetFrameCount();Returns the number of stack frames in the backtrace.
intGetFrameFilestring
public string GetFrameFile(int index);Returns the file name of the call site represented by the stack frame at the specified index.
| Name | Type | Default |
|---|---|---|
index | int | — |
stringGetFrameFunctionstring
public string GetFrameFunction(int index);Returns the name of the function called at the stack frame at the specified index.
| Name | Type | Default |
|---|---|---|
index | int | — |
stringGetFrameLineint
public int GetFrameLine(int index);Returns the line number of the call site represented by the stack frame at the specified index.
| Name | Type | Default |
|---|---|---|
index | int | — |
intGetGlobalVariableCountint
public int GetGlobalVariableCount();Returns the number of global variables (e.g. autoload singletons) in the backtrace.
Note: This will be non-zero only if the include_variables parameter was true when capturing the backtrace with Engine.CaptureScriptBacktraces.
intGetGlobalVariableNamestring
public string GetGlobalVariableName(int variableIndex);Returns the name of the global variable at the specified index.
| Name | Type | Default |
|---|---|---|
variableIndex | int | — |
stringGetGlobalVariableValueVariant
public Variant GetGlobalVariableValue(int variableIndex);Returns the value of the global variable at the specified index.
Warning: With C# backtraces, the returned Variant will be the variable's actual value, including any object references. This means that storing the returned Variant will prevent any such object from being deallocated, so it's generally recommended not to do so.
| Name | Type | Default |
|---|---|---|
variableIndex | int | — |
VariantGetLanguageNamestring
public string GetLanguageName();Returns the name of the script language that this backtrace was captured from.
stringGetLocalVariableCountint
public int GetLocalVariableCount(int frameIndex);Returns the number of local variables in the stack frame at the specified index.
Note: This will be non-zero only if the include_variables parameter was true when capturing the backtrace with Engine.CaptureScriptBacktraces.
| Name | Type | Default |
|---|---|---|
frameIndex | int | — |
intGetLocalVariableNamestring
public string GetLocalVariableName(int frameIndex, int variableIndex);Returns the name of the local variable at the specified variable_index in the stack frame at the specified frame_index.
| Name | Type | Default |
|---|---|---|
frameIndex | int | — |
variableIndex | int | — |
stringGetLocalVariableValueVariant
public Variant GetLocalVariableValue(int frameIndex, int variableIndex);Returns the value of the local variable at the specified variable_index in the stack frame at the specified frame_index.
Warning: With C# backtraces, the returned Variant will be the variable's actual value, including any object references. This means that storing the returned Variant will prevent any such object from being deallocated, so it's generally recommended not to do so.
| Name | Type | Default |
|---|---|---|
frameIndex | int | — |
variableIndex | int | — |
VariantGetMemberVariableCountint
public int GetMemberVariableCount(int frameIndex);Returns the number of member variables in the stack frame at the specified index.
Note: This will be non-zero only if the include_variables parameter was true when capturing the backtrace with Engine.CaptureScriptBacktraces.
| Name | Type | Default |
|---|---|---|
frameIndex | int | — |
intGetMemberVariableNamestring
public string GetMemberVariableName(int frameIndex, int variableIndex);Returns the name of the member variable at the specified variable_index in the stack frame at the specified frame_index.
| Name | Type | Default |
|---|---|---|
frameIndex | int | — |
variableIndex | int | — |
stringGetMemberVariableValueVariant
public Variant GetMemberVariableValue(int frameIndex, int variableIndex);Returns the value of the member variable at the specified variable_index in the stack frame at the specified frame_index.
Warning: With C# backtraces, the returned Variant will be the variable's actual value, including any object references. This means that storing the returned Variant will prevent any such object from being deallocated, so it's generally recommended not to do so.
| Name | Type | Default |
|---|---|---|
frameIndex | int | — |
variableIndex | int | — |
VariantIsEmptybool
public bool IsEmpty();Returns true if the backtrace has no stack frames.
bool