CN Version(中文版)

Blueprint Console Command System

高性能的虚幻引擎5蓝图控制台命令系统,提供毫秒级执行性能和完整的蓝图集成。

✨ 主要特性

  • 直接命令注册 - 无需 BlueprintCommand 前缀,直接输入命令名

  • 简单易用 - 只需调用 Bind Command 即可注册命令

  • 高性能 - 毫秒级命令执行

  • 完整蓝图支持 - 所有功能都可在蓝图中使用

  • 强大的参数解析 - 内置参数解析器支持多种数据类型

  • 线程安全 - 支持多线程环境

  • 自动清理 - 退出时自动注销命令

🚀 快速开始

1. 添加组件

在您的 Character 或 GameMode 蓝图中添加 Blueprint Console Command System 组件。

2. 注册命令

Event BeginPlay 中:

Event BeginPlay

Bind Command (Command Name: "111")

Bind Command (Command Name: "222")

Bind Event to On Blueprint Command Executed

3. 处理命令

Custom Event: On Blueprint Command Executed (CommandName, Parameters)

Switch on String (CommandName)
    ├─ "111" → [您的逻辑]
    └─ "222" → [您的逻辑]

4. 使用命令

打开控制台(~ 键)输入:

  • 111

  • 222

  • 111 test parameters

📚 参数解析

使用内置的 Blueprint Console Command Parser 轻松解析参数:

Parameters → Get Parameter As Int (Index: 0) → Result
Parameters → Get Parameter As Float (Index: 1) → Result
Parameters → Get Parameter As Vector (Start Index: 2) → Result

支持的数据类型

  • 基础类型: String, Int, Float, Bool

  • 复杂类型: Vector, Rotator

  • 批量解析: 数组类型

  • 命名参数: key=value 格式

📖 文档

🔧 API 概览

命令注册

函数
说明

Bind Command

注册命令(自动注册为控制台命令)

Unbind Command

注销命令

Get Registered Commands

获取所有已注册命令

Is Command Registered

检查命令是否已注册

参数解析

函数
说明

Get Parameter As Int

解析整数参数

Get Parameter As Float

解析浮点数参数

Get Parameter As Bool

解析布尔值参数

Get Parameter As Vector

解析向量参数

Get All Parameters As Int

批量解析整数

Parse Named Parameters

解析命名参数

💡 使用示例

示例 1: 传送命令

命令: tp 100 200 300

蓝图:
Parameters → Get Parameter As Vector → Set Actor Location

示例 2: 设置属性命令

命令: setprop health=100 speed=5.5

蓝图:
Parameters → Parse Named Parameters
    ├─ Get Named Parameter As Int (health)
    └─ Get Named Parameter As Float (speed)

示例 3: 批量处理

命令: numbers 10 20 30 40 50

蓝图:
Parameters → Get All Parameters As Int → For Each Loop → Print

⚙️ 配置选项

Bind Command 参数

  • Command Name (String) - 命令名称

  • Register as Console Command (Bool) - 是否注册为独立控制台命令(默认:true)

🎯 性能特性

  • O(1) 命令查找 - 使用哈希表实现快速查找

  • 线程安全 - 使用临界区保护共享数据

  • 内存预分配 - 预分配内存池减少运行时分配

  • 帧率限制 - 每帧最多执行100个命令

  • 性能监控 - 内置命令执行统计

🛠️ 系统要求

  • Unreal Engine 5.6+

  • C++ 编译环境

  • Windows/Mac/Linux

📝 版本历史

v1.0.0

  • ✅ 初始版本发布

  • ✅ 直接命令注册功能

  • ✅ 完整的参数解析器

  • ✅ 蓝图完全集成

  • ✅ 高性能命令执行

🤝 贡献

欢迎提交 Issue 和 Pull Request!

📄 许可证

MIT License

💬 支持

如有问题,可来Dicord社区找我!

https://discord.com/invite/PGYbqVcqBf


享受高效的命令系统开发体验! 🎉

Last updated