FindFirstOf

FindFirstOf

FindFirstOf 函数查找指定类名的第一个非默认实例。

此函数无法查找非实例对象或默认实例。

参数

# 类型 说明
1 string 要查找其实例的类的短名称

返回值

# 类型 说明
1 UObject, UClass, or AActor 仅当找到实例时,返回的对象才有效

示例

local CharacterInstance = FindFirstOf("Character")
if not CharacterInstance:IsValid() then
    print("No instance of class 'Character' was found.")
end

原文:docs/lua-api/global-functions/findfirstof.md · 固定提交 560411f18512 · 来源与 MIT 许可