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()}")
相关推荐
西梅汁5 分钟前
C++ 观察者模式
笔记
لا معنى له40 分钟前
Var-JEPA:联合嵌入预测架构的变分形式 —— 连接预测式与生成式自监督学习 ----论文翻译
人工智能·笔记·学习·语言模型
chase。1 小时前
【学习笔记】让机器人“边想边动”——实时动作分块流策略的执行方法
笔记·学习·机器人
[ ]8981 小时前
Stack_MLAG_知识点梳理
网络·笔记·网络协议
唐樽1 小时前
C++ 竞赛学习路线笔记
c++·笔记·学习
bobasyu2 小时前
Claude Code 源码笔记 -- queryLoop
java·笔记·spring
水云桐程序员2 小时前
Quartus II集成开发环境 |FPGA
笔记·fpga开发·硬件工程·创业创新
禹中一只鱼3 小时前
【Charles 抓包工具笔记】(自用复盘版)
笔记·charles·抓包工具·配置代理
Kang.Charles3 小时前
UE游戏性能优化归结(基于UE5环境)
游戏·ue5
Java面试题总结3 小时前
Nginx 配置笔记
运维·笔记·nginx