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()}")
相关推荐
知产xiao_xin5 小时前
知识产权入门 —— 相关权(邻接权)
经验分享·笔记·知识产权
自小吃多6 小时前
DXF文件导入与PCB板框定义笔记
笔记·嵌入式硬件
jike_20267 小时前
iPhone采访录音同时拍现场照片的APP:图片音频同步记录实测
笔记·智能手机·音视频·语音识别
————A9 小时前
Agent 接收用户上传文件
人工智能·笔记·python·状态模式
奔跑的痕迹9 小时前
如何删除引力画报?
笔记
zbyyd9 小时前
Linux 进程间通信学习笔记
linux·笔记·学习
知产xiao_xin10 小时前
知识产权入门 —— 版权
经验分享·笔记·知识产权
呆萌很10 小时前
英语 1‑12 月单词联想记忆
笔记
金立基包装胶水12 小时前
纸袋热封频繁不良,先排查胶料这一堆问题
大数据·笔记·其他
常驻客栈12 小时前
B-深入理解计算机系统第3版之第11章:网络编程
开发语言·笔记·学习笔记·常驻客栈·深入理解计算机系统