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()}")
相关推荐
sbjdhjd5 小时前
网工进阶笔记:H3CSE 园区网全栈技术与协议汇总
网络·笔记·云计算·ssh·网络工程·vlan·aaa
海绵宝宝的月光宝盒8 小时前
14-AutoCAD-阵列命令应用与案例实战(AR)
经验分享·笔记·自动化·课程设计·制造·学习方法·cad
白山编程大哥9 小时前
接口幂等性是什么?如何设计?
笔记
ACP广源盛139246256739 小时前
6 盘位存储扩展方案选型笔记:YLB3116 @ACP评估记录
笔记·硬件架构·硬件工程·国产芯片
小李不想当小白9 小时前
SPI通信外设与W25Q64 (硬件SPI)(STM32标准库学习笔记)
笔记·stm32·单片机·嵌入式硬件·学习·嵌入式
weixin_4481199412 小时前
Datawhale Jev Cookbook 202610 笔记3
笔记
姚瑞南12 小时前
【PRD】招投标商机雷达爬虫系统
人工智能·经验分享·笔记·爬虫·产品运营·产品经理
Gnevergiveup12 小时前
ATT&CK红蓝对抗实战指南-Windows安全基础
笔记·网络安全
江屿风15 小时前
【Plain Language Large Model】【从麦当劳点餐到Redis接入:MCP如何让AI工具集成变简单】流食般投喂
人工智能·redis·笔记·语言模型·llm·mcp
海绵宝宝转agent16 小时前
Leetcode二叉树算法个人理解
笔记·学习·算法·leetcode·深度优先