ue python脚本 获取资产

ue 获取资产

python 复制代码
import unreal

actor_name = "BP_Bernice"

# 获取 Editor Actor Utilities Subsystem
subsystem = unreal.get_editor_subsystem(unreal.EditorActorSubsystem)

# 获取所有关卡 Actor
actors = subsystem.get_all_level_actors()

for a in actors:
    print(a.get_name())
    if a.get_name() == actor_name:
        comps = a.get_components_by_class(unreal.ActorComponent)
        for c in comps:
            print(c.get_name(), c.get_class())

让资产移动脚本:

python 复制代码
import unreal

# Actor 名称
actor_name = "BP_Bernice_C_UAID_24B2B9B96FE856AF02_1876048431"

# 获取 Editor Actor Utilities Subsystem
subsystem = unreal.get_editor_subsystem(unreal.EditorActorSubsystem)

# 获取所有关卡 Actor
actors = subsystem.get_all_level_actors()

for a in actors:
    if a.get_name() == actor_name:
        print(f"Found actor: {a.get_name()}")

        # 打印组件信息
        comps = a.get_components_by_class(unreal.ActorComponent)
        for c in comps:
            print(c.get_name(), c.get_class())

        # --- 移动 Actor ---
        current_location = a.get_actor_location()
        print(f"Current location: {current_location}")

        # 偏移量,可以改成你想要的
        offset = unreal.Vector(100, 0, 0)  # 在X轴方向移动100单位

        new_location = current_location + offset
        a.set_actor_location(new_location, sweep=False, teleport=False)

        print(f"New location: {a.get_actor_location()}")
相关推荐
西岸行者3 天前
学习笔记:SKILLS 能帮助更好的vibe coding
笔记·学习
starlaky3 天前
Django入门笔记
笔记·django
勇气要爆发3 天前
吴恩达《LangChain LLM 应用开发精读笔记》1-Introduction_介绍
笔记·langchain·吴恩达
悠哉悠哉愿意3 天前
【单片机学习笔记】串口、超声波、NE555的同时使用
笔记·单片机·学习
勇气要爆发3 天前
吴恩达《LangChain LLM 应用开发精读笔记》2-Models, Prompts and Parsers 模型、提示和解析器
android·笔记·langchain
qianshanxue113 天前
计算机操作的一些笔记标题
笔记
土拨鼠烧电路3 天前
笔记11:数据中台:不是数据仓库,是业务能力复用的引擎
数据仓库·笔记
土拨鼠烧电路3 天前
笔记14:集成与架构:连接孤岛,构建敏捷响应能力
笔记·架构
烟花落o3 天前
栈和队列的知识点及代码
开发语言·数据结构·笔记·栈和队列·编程学习