此函数在运行时在 输出窗口 和 调试覆盖层 中显示自定义调试消息。
此函数的语法与 string_ext 函数的语法相同除了单个参数外,它还可以接受带有占位符的格式字符串,以及带有要替换占位符的附加参数的数组。
Real 类型为整数的值在字符串中不会有小数位。具有小数部分的 Real 类型的值在字符串中有两个小数位。如果在输出字符串中需要更多的小数位,可以使用函数string_format。
Values of type Struct or Instance will be converted to a string using that struct's or instance's toString() Method if one exists, or converted to a string implicitly.
Values of type Handle will be converted to a string that shows the handle info: "ref <type> <id>".
Values of type Array will be converted to a string of the format [element1, element2, element3, element4, element5], i.e. the concatenation of all elements in the array. If any of the elements in the array is a struct or an instance then its will be called to convert it to a string.
show_debug_message_ext(value_or_format, values_array);
参数 | 类型 | 描述 |
---|---|---|
value_or_format | Any (if value) or String (if format) | 要转换为字符串的值。 |
values_array | Array of Any | 可选 包含要插入到占位符位置的值的数组。 |
N/A
show_debug_message_ext("{0} - {1}", [1, "First item"]);
numbers = [59, 23, 656, 8, 54];
array_sort(numbers, true);
show_debug_message_ext("The three lowest numbers are: {0}, {1} and {2}", numbers);
上面的代码首先定义一个包含一些数字的数组,并按升序对它们进行排序。然后,它在 show_debug_message_ext() 中使用该数组来调用以将其前三个数字插入到格式字符串中,然后将结果字符串打印到输出日志。