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

推荐订阅源

人人都是产品经理
人人都是产品经理
Stack Overflow Blog
Stack Overflow Blog
L
LINUX DO - 最新话题
Google Online Security Blog
Google Online Security Blog
Schneier on Security
Schneier on Security
Spread Privacy
Spread Privacy
www.infosecurity-magazine.com
www.infosecurity-magazine.com
雷峰网
雷峰网
Google DeepMind News
Google DeepMind News
Microsoft Azure Blog
Microsoft Azure Blog
IT之家
IT之家
V
Vulnerabilities – Threatpost
K
Kaspersky official blog
S
Schneier on Security
B
Blog
The Register - Security
The Register - Security
SecWiki News
SecWiki News
Hacker News: Ask HN
Hacker News: Ask HN
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security Affairs
T
The Blog of Author Tim Ferriss
G
Google Developers Blog
T
Tenable Blog
P
Proofpoint News Feed
Apple Machine Learning Research
Apple Machine Learning Research
D
DataBreaches.Net
S
Secure Thoughts
Security Latest
Security Latest
H
Heimdal Security Blog
The Hacker News
The Hacker News
O
OpenAI News
AWS News Blog
AWS News Blog
量子位
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
腾讯CDC
U
Unit 42
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
L
LangChain Blog
阮一峰的网络日志
阮一峰的网络日志
T
The Exploit Database - CXSecurity.com
NISL@THU
NISL@THU
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Hugging Face - Blog
Hugging Face - Blog
The Last Watchdog
The Last Watchdog
Recorded Future
Recorded Future
V2EX - 技术
V2EX - 技术
爱范儿
爱范儿
F
Full Disclosure

博客园 - 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 }