惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
SecWiki News
SecWiki News
博客园_首页
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
P
Palo Alto Networks Blog
V
Vulnerabilities – Threatpost
Project Zero
Project Zero
WordPress大学
WordPress大学
NISL@THU
NISL@THU
酷 壳 – CoolShell
酷 壳 – CoolShell
P
Privacy & Cybersecurity Law Blog
Jina AI
Jina AI
AWS News Blog
AWS News Blog
Scott Helme
Scott Helme
Martin Fowler
Martin Fowler
C
Cybersecurity and Infrastructure Security Agency CISA
Forbes - Security
Forbes - Security
H
Heimdal Security Blog
小众软件
小众软件
I
Intezer
A
Arctic Wolf
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
O
OpenAI News
S
Security Affairs
阮一峰的网络日志
阮一峰的网络日志
Latest news
Latest news
G
GRAHAM CLULEY
Blog — PlanetScale
Blog — PlanetScale
J
Java Code Geeks
N
News and Events Feed by Topic
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
V2EX - 技术
V2EX - 技术
Stack Overflow Blog
Stack Overflow Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
L
LINUX DO - 最新话题
博客园 - Franky
P
Proofpoint News Feed
aimingoo的专栏
aimingoo的专栏
博客园 - 司徒正美
P
Proofpoint News Feed
S
Secure Thoughts
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
T
The Exploit Database - CXSecurity.com
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
F
Full Disclosure
Security Latest
Security Latest

博客园 - sun_dust_shadow

(翻译) 延迟补偿方法的协议设计与优化 Latency Compensating Methods in Client/Server In-game Protocol Design and Optimization (翻译) Dota2 Random Distribution Dota2中的随机分布 (个人思考)游戏技能的实现 (读书笔记)平衡掌控者 [瞄准辅助] 实现一种柔和平滑的瞄准辅助 (个人思考)实现游戏GAS系统中的Tag (翻译) Efficiency Tips on Switching Spaces and Transformation Matrices in Unity (翻译) V Rising's Animation Layering in Unity (翻译 unity2020.1) Understanding the managed heap (翻译 ue gas) Gameplay Ability 总结 Overwatch Gameplay Architecture and Netcode 守望先锋的游戏架构与网络代码 (翻译 ) Source Multiplayer Networking Source引擎的多人网路系统 (翻译 gafferongames) Networked Physics in Virtual Reality VR中的网络物理 Topdown游戏中Input朝向的转化 (翻译 gafferongames) Client Server Connection 客户端服务器连接 (翻译 gafferongames)Reliable Ordered Messages 可靠有序消息 (翻译 gafferongames) Sending Large Blocks of Data 发送大块数据 (翻译 gafferongames) Packet Fragmentation and Reassembly 数据包分片与重组 游戏中Shotgun(喷子)发射子弹的实现
(UnityEditor Tool) 语音控制unity editor暂停和播放
sun_dust_shadow · 2025-04-16 · via 博客园 - sun_dust_shadow
在Windows平台上可以通过KeywordRecognizer识别简单的语音关键字,我们可以通过麦克风控制编辑器的开启、暂停、关闭
只是一个有趣的小实验
 1 using System;
 2 using UnityEngine;
 3 using UnityEngine.Windows.Speech;
 4 using System.Collections.Generic;
 5 using System.Linq;
 6 using UnityEditor;
 7 
 8 namespace Game.Editor
 9 {
10     public class EditorVoiceKeywordRecognition : EditorWindow
11     {
12         private  KeywordRecognizer _keywordRecognizer;
13         private readonly Dictionary<string, System.Action> _keywords;
14 
15         [MenuItem("Tools/Custom/Voice Control")]
16         public static void ShowWindow()
17         {
18             EditorWindow.GetWindow(typeof(EditorVoiceKeywordRecognition), false, "Voice Control");
19         }
20 
21         private EditorVoiceKeywordRecognition()
22         {
23             _keywords = new Dictionary<string, System.Action>
24             {
25                 {
26                     "pause", () =>
27                     {
28                         EditorApplication.isPaused = !EditorApplication.isPaused;
29                     }
30                 },
31                 {
32                     "stop", () =>
33                     {
34                         EditorApplication.isPlaying = false;
35                     }
36                 },
37 
38                 {
39                     "play", () =>
40                     {
41                         EditorApplication.isPlaying = true;
42                     }
43                 }
44             };
45         }
46 
47         private void Awake()
48         {
49             _keywordRecognizer = new KeywordRecognizer(_keywords.Keys.ToArray());
50             _keywordRecognizer.OnPhraseRecognized += OnKeywordsRecognized;
51             _keywordRecognizer.Start();
52             Debug.Log("Keyword Recognizer Started");
53         }
54 
55         private void OnDestroy()
56         {
57             if (_keywordRecognizer != null)
58             {
59                 _keywordRecognizer.Stop();
60                 _keywordRecognizer.Dispose();
61                 Debug.Log("Keyword Recognizer Stopped");
62             }
63         }
64 
65         private void OnGUI()
66         {
67             GUILayout.Label("Voice Control", EditorStyles.boldLabel);
68             if (_keywordRecognizer != null && _keywordRecognizer.IsRunning)
69             {
70                 GUILayout.Label("Voice Recognition: Running");
71             }
72             else
73             {
74                 GUILayout.Label("Voice Recognition: Stopped");
75             }
76 
77             if (GUILayout.Button("Restart Recognizer"))
78             {
79                 _keywordRecognizer.Stop();
80                 _keywordRecognizer.Start();
81             }
82         }
83 
84         private void OnKeywordsRecognized(PhraseRecognizedEventArgs args)
85         {
86             Debug.Log($"Recognized Keyword: {args.text}");
87             if (_keywords.TryGetValue(args.text, out Action keyword))
88             {
89                 keyword?.Invoke();
90             }
91         }
92     }
93 }