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()}")
相关推荐
优雅的潮叭9 小时前
c++ 学习笔记之 shared_ptr
c++·笔记·学习
claider9 小时前
Vim User Manual 阅读笔记 usr_08.txt Splitting windows 窗口分割
笔记·编辑器·vim
am心9 小时前
学习笔记-用户下单
笔记·学习
要做朋鱼燕13 小时前
【AES加密专题】3.工具函数的编写(1)
笔记·密码学·嵌入式·aes
嵌入式知行合一14 小时前
时间管理方法论
笔记
儒雅的晴天14 小时前
git笔记
笔记·git
半夏知半秋14 小时前
kcp学习-通用的kcp lua绑定
服务器·开发语言·笔记·后端·学习
中屹指纹浏览器15 小时前
指纹浏览器底层沙箱隔离技术实现原理与架构优化
经验分享·笔记
小裕哥略帅17 小时前
PMP知识--五大过程组
笔记·学习
Aliex_git17 小时前
提示词工程学习笔记
人工智能·笔记·学习