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()}")
相关推荐
左左右右左右摇晃13 小时前
计算机网络笔记整理
笔记·计算机网络
不吃西红柿的8513 小时前
[职场] 内容运营求职简历范文 #笔记#职场发展
笔记·职场和发展·内容运营
似水明俊德14 小时前
02-C#.Net-反射-学习笔记
开发语言·笔记·学习·c#·.net
智者知已应修善业14 小时前
【51单片机独立按键控制数码管移动反向,2片74CH573/74CH273段和位,按键按下保持原状态】2023-3-25
经验分享·笔记·单片机·嵌入式硬件·算法·51单片机
C羊驼15 小时前
C语言:两天打鱼,三天晒网
c语言·经验分享·笔记·算法·青少年编程
sheeta199815 小时前
苍穹外卖Day04笔记
笔记
今儿敲了吗19 小时前
46| FBI树
数据结构·c++·笔记·学习·算法
苦瓜小生19 小时前
【黑马点评学习笔记 | 实战篇 】| 6-Redis消息队列
redis·笔记·后端
sheeta199820 小时前
LeetCode 每日一题笔记 日期:2025.03.19 题目:3212.统计X和Y频数相等的子矩阵数量
笔记·leetcode·矩阵
巧克力味的桃子21 小时前
国名排序题笔记(字符串函数 + fgets 详解)
笔记