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()}")
相关推荐
小韩博2 小时前
小迪笔记45课之-PHP应用&SQL二次注入&堆叠执行&DNS带外&功能点&黑白盒条件
笔记·sql·网络安全·php
智嵌电子2 小时前
【笔记篇】【硬件基础篇】模拟电子技术基础 (童诗白) 第6章 信号的运算和处理
笔记
virtual_k1smet2 小时前
梧桐·鸿鹄-中移链assistant-level
笔记·区块链
AI视觉网奇3 小时前
audio2face docker方式
docker·ue5
丝斯20114 小时前
AI学习笔记整理(36)——自然语言处理
人工智能·笔记·学习
94621931zyn64 小时前
观影统计 - Cordova 与 OpenHarmony 混合开发实战
笔记
virtual_k1smet4 小时前
梧桐·鸿鹄-大数据professional
大数据·笔记
stars-he4 小时前
单相双半波可控整流电路的MATLAB仿真设计
笔记·学习·matlab
im_AMBER4 小时前
Leetcode 87 等价多米诺骨牌对的数量
数据结构·笔记·学习·算法·leetcode