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()}")
相关推荐
JustDI-CM2 小时前
AI学习笔记-提示词工程
人工智能·笔记·学习
爱写bug的野原新之助2 小时前
加密摘要算法MD5、SHA、HMAC:学习笔记
笔记·学习
小乔的编程内容分享站3 小时前
C语言笔记之函数
c语言·笔记
四谎真好看4 小时前
JavaWeb学习笔记(Day13)
笔记·学习·学习笔记·javaweb
承渊政道4 小时前
Linux系统学习【Linux基础开发工具】
linux·运维·笔记·学习·centos·编辑器
承渊政道4 小时前
C++学习之旅【C++中模板进阶内容介绍】
c语言·c++·笔记·学习·visual studio
浅念-4 小时前
C语言——动态内存管理
c语言·开发语言·c++·笔记·学习
ASKED_201913 小时前
Langchain学习笔记一 -基础模块以及架构概览
笔记·学习·langchain
Lois_Luo14 小时前
Obsidian + Picgo + Aliyun OSS 实现笔记图片自动上传图床
笔记·oss·图床
(❁´◡`❁)Jimmy(❁´◡`❁)14 小时前
Exgcd 学习笔记
笔记·学习·算法