<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Tina on Medium]]></title>
        <description><![CDATA[Stories by Tina on Medium]]></description>
        <link>https://medium.com/@Tina70245?source=rss-94ee633c7f10------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vCvxROZc1I-jbyphg0fiWQ.jpeg</url>
            <title>Stories by Tina on Medium</title>
            <link>https://medium.com/@Tina70245?source=rss-94ee633c7f10------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 22:55:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Tina70245/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[一年 N2 學習通過紀錄]]></title>
            <link>https://medium.com/@Tina70245/%E4%B8%80%E5%B9%B4-n2-%E5%AD%B8%E7%BF%92%E9%80%9A%E9%81%8E%E7%B4%80%E9%8C%84-22d54d4597f9?source=rss-94ee633c7f10------2</link>
            <guid isPermaLink="false">https://medium.com/p/22d54d4597f9</guid>
            <dc:creator><![CDATA[Tina]]></dc:creator>
            <pubDate>Tue, 17 Sep 2024 16:33:00 GMT</pubDate>
            <atom:updated>2024-09-17T17:23:58.397Z</atom:updated>
            <content:encoded><![CDATA[<h3>一年日檢 N2 通過紀錄</h3><h3>前言</h3><p>總之先放個成績。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*6l6HroxxVFEwAFuGIow9KQ@2x.jpeg" /></figure><p>本來很擔心自己這麼衝動，都還沒確定日檢會考怎樣就跑來日本準備找工作會不會出事，還好成績沒問題，然後想寫文記錄一下時赫然驚覺自己上次發文已經是去年的事Orz，雖然一直都有寫一些內容但遲遲沒完成發出來，再拖下去2024都要過去了，趕緊發一篇證明自己還活著。</p><p>雖然說是一年，不過前半年基本上都在做一些課外+課內事務的收尾，因為錯估一些事件的難度，多花不少時間在這些上面，為了督促自己念日文有報名12月的N2，但很有自知之明自己絕對考不過，只是試試水溫，沒想到一試發現不是有點爛，是爛斃了，不用看到成績就知道自己過不了的爛Orz，不過當時已經下定決心要在日本找工作，所以下半年就很拼命的寫起題目來唸日文……。</p><p>因為網路上已經有很多類似的文章了，這邊就純粹紀錄這過程我自己的學習方式，非常的個人取向，參考看看就好。</p><h3>學日文的契機</h3><p>其實按照原本的計畫，我應該是在台灣工作2年後才要考日檢，本來大四是想要在準備面試跟打電動度過的，只是在大學的四年，實在是很貼身的體驗到什麼叫做計畫趕不上變化，剛升大學時曾經覺得至少可以試試看的機會，等到自己真的有點實力時，都已經不復存在（嘆氣）。</p><p>尤其在各種與台灣業界的人互動後，真正意識到遊戲業（跟一般寫程式的行業）可以發展到的天花板，再加上自己有一個小時候想達成的夢想，不過因為真的太難，我有給自己一個年齡限制，超過就應該放棄面對現實了。</p><p>交叉比對跟思考後，結果最後就變成畢業就衝去日本找工作，畢竟現在不把握，以後說不定就永遠沒機會了……。</p><p>而上面的成績為何用日語表示，就是因為我已經在日本了。</p><h3>在這之前的程度跟學習方式</h3><p>雖然高中畢業前有背過 50 音，然而升大學做了一堆其他的事情後，等大四回過頭想要認真背時，基本上 50 音的記憶跟打掉重來沒兩樣，可以說是從零開始。</p><p>而大四這段時間，上學期有修一些學校的日文課，下學期因為學分夠畢業+覺得剩下的還是自己念比較快就沒繼續上了，大半時間還是自己學為主。</p><h3>有用到的參考書/考試題庫</h3><ul><li>大家學標準日本語</li><li>日本語句型辭典</li><li>上級で学ぶ日本語</li><li>穩紮穩打！新日文語能力試驗 長句構造解析</li><li>新日檢完勝500題N2</li><li>新日檢N2模擬試題＋完全解析</li><li>歷屆考古題</li></ul><p>還有Migii…不過看個人對錯誤的容忍度，詳解的錯誤不少，程式也有點 bug，除非對自己的自制力很有把握想在一年內寫完N5~N2，還願意自己 Google 訂正錯誤不然花錢有點不划算。</p><p>不過我錢都花下去了，所以我還是把N2的題庫寫完了。不過變回免費版後，我還是會寫官方定時出的Online Test，還有文法題就是，現在更當是順便學英文的軟體（？）。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*ofuCeHNqchvqvn0Wz4VdYg.png" /></figure><h3>休閒娛樂</h3><h4>日劇/動畫/小說</h4><ul><li>俺の家の話</li><li>大豆田とわ子と三人の元夫</li><li>3年A組</li><li>天国と地獄</li><li>極主夫道</li><li>薬屋のひとりごと</li><li>小説家になろう跟Pixiv的各種二創小說</li></ul><p>其中我在看小說跟程式書時，會用下面的ふりがな軟體跟字典，這樣才不用手動查漢字跟意思查到瘋掉，不過最好至少到N3~N2左右的程度在開始看，不然就算有輔助軟體，連在一起的平假名跟動詞變化還是會看到滿腦子問號。</p><ul><li><a href="https://apps.apple.com/jp/app/%E3%81%B5%E3%82%8A%E3%81%8C%E3%81%AA/id924351286">‎ふりがな</a></li><li><a href="https://chromewebstore.google.com/detail/rikaikun/jipdnfibhldikgcjhfnomkfpcebammhp">rikaikun - Chrome Web Store</a></li><li><a href="https://chromewebstore.google.com/detail/%E3%81%B5%E3%82%8A%E3%81%8C%E3%81%AA%E4%BB%98%E4%B8%8E%E6%A9%9F%E8%83%BD%E3%83%BB%E3%82%B5%E3%83%86%E3%83%A9%E3%82%A4%E3%83%88%E3%82%AA%E3%83%95%E3%82%A3%E3%82%B9/ondlbgninleaekgfkbbaloinfojpcmdn">ふりがな付与機能・サテライトオフィス - Chrome Web Store</a></li></ul><h4>電玩</h4><ul><li>クレヨンしんちゃん：炭の町のシロ</li><li>マザーシリーズ</li><li>マリオ&amp;ルイージRPG</li><li>マリオ+ラビッツ ：ギャラクシーバトル</li><li>九日封測的日文協助校搞（不過當時的日文能力只夠看懂，不具備造句功能就是了哈哈……）</li><li>あつ森與他的厚到爆炸的日文攻略本（我只是好奇這攻略本是啥才買的，不過裡面的漢字都有標平假名，是真的幫我記住了不少我一直記不住的發音。）</li></ul><p>其中初學日文時其實挺推薦動物森友會的，裡面的不少日常單字，不管是考試還是未來在日本生活時都會遇到，而且裡面滿滿的平假名跟片假名內容有助於這部分的閱讀速度上升。</p><h3>Youtube</h3><ul><li><a href="https://www.youtube.com/@sora_sakurai_jp">桜井政博のゲーム作るには</a></li><li><a href="https://www.youtube.com/@IGNJapan">IGN Japan</a></li><li><a href="https://www.youtube.com/@kentworldg">KENT for 任天堂ゲームレビュー</a></li></ul><p>……等各種遊戲消息與開發相關的頻道，平常沒事就撥在背景當BGM聽，聽久了就比較能大概知道意思了。</p><h3>考試的方式</h3><p>其實有點取巧，因為寫歷屆試題時，發現自己的文法是爛到一個無藥可救的程度，不過單字已經背到可以 Cover 掉文法的部分，所以寫的時候就直接大半文法都用猜的，把時間拿來認真寫閱讀，寫到後來甚至還有時間可以重新檢查一次，可能就是因為這樣閱讀才能滿分吧。</p><p>聽力的話，因為自己還聽沒有很熟，很常發生覺得很耳熟但就是想不起意思的狀況，所以聽力再撥的時候就是能寫下多少關鍵字就寫多少，然後在聽力到一個段落時回頭看關鍵字確認自己有沒有寫錯。</p><h3>後記</h3><p>雖然考過了N2，不過實際上跟日本人互動過後，確確實實感受到考得過N2跟能實際與日本人說話有著多大的距離。</p><p>尤其本來還挺逃避文法背誦的，直到自己看起各種日文書籍，還有跟著日本頻道說日文時……嗯果然文法還是需要背的（捂臉）。</p><p>N2只是一個最低可以開始找工作的門檻而已，實際上要能靈活應用可還有著非常長的路阿，不過自己並沒有那麼多時間……只能加油了。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22d54d4597f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Thread、Coroutine使用紀錄]]></title>
            <link>https://medium.com/@Tina70245/thread-coroutine%E4%BD%BF%E7%94%A8%E7%B4%80%E9%8C%84-f3b42f9ddfa0?source=rss-94ee633c7f10------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3b42f9ddfa0</guid>
            <category><![CDATA[threads]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[coroutine]]></category>
            <dc:creator><![CDATA[Tina]]></dc:creator>
            <pubDate>Fri, 02 Jun 2023 10:01:46 GMT</pubDate>
            <atom:updated>2023-06-02T10:01:46.651Z</atom:updated>
            <content:encoded><![CDATA[<h3>前言</h3><p>之前做流離之歌是第一次使用到 Coroutine 的機制，還因為不知道它平行化運行的功能還困惑過為甚麼還沒跑完範圍內的判斷就跑了下一行的程式。</p><p>而到了這次的 VR 專案，因為需要使用到與 GCP 連線時會直接吃到太多 main thread 的資源導致卡頓，故需要用 thread 的 async 寫法讓遊戲不會卡頓，而下面會說明 Thread 與 Coroutine 的不同，還有在 Unity 中的使用。</p><h3>Thread、Coroutine</h3><p>Thread 和 Coroutine 都是實現異步操作的程式設計概念，但它們之間有幾個主要的不同之處：</p><p>1. 執行方式：Thread 是由作業系統負責調度的獨立程式，它運行在自己的獨立空間中。Coroutine 則是由程式碼主動控制的，它可以在同一 thread 內的不同區塊中進行切換。</p><p>2. 資源消耗：每個 Thread 都需要額外的資源來維護其執行狀態。相比之下，Coroutine 的資源消耗較低，因為它們在同一 Thread 中共享資源，並且切換開銷較小。</p><p>3. 同步處理：Thread 可以同時執行多個任務，每個任務都運行在獨立的程式中，可以實現真正的平行處理。Coroutine 則是基於協作式多工(Cooperative multitasking)，需要在適當的時間點手動釋放控制權，才能切換到其他的 Coroutine。</p><p>Thread 提供了真正的平行處理能力，但使用多個 Thread 需要額外的資源，並且可能需要進行同步來確保資料一致性。Coroutine 則提供了一種輕量級的異步處理機制，並且在處理過程中更具有控制彈性。</p><h3>在 Unity 中的機制</h3><p>在 Unity 裡是鼓勵使用 Coroutine ，也就是常見的 IEnumator 寫法，而這些 Coroutine 都是在 Main Thread 執行。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*1Xnk-UF5caUxvmx6FF7E5Q.png" /></figure><p>實際上現在 Unity 還提供的異步方式為 Job System，關於這部分可以參考看看下方的連結去查看。</p><p><a href="https://medium.com/akatsuki-taiwan-technology/unity-%E5%88%A9%E7%94%A8c-job-system%E8%88%87burst-compiler%E4%BE%86%E8%A7%A3%E6%94%BEcpu%E7%9A%84%E6%95%88%E8%83%BD-c9447357a076">[Unity]利用C# Job System與Burst Compiler來解放CPU的效能</a></p><p>而在這次 VR 專案中，由於不管是在更新麥克風收到的音訊資料、還是等待文字版內容傳回來的過程，如果都只在 Main Thread 傳遞的話，就容易發生遊戲 Lag 的情況，以這次的處理方式，是用 Thread 的 async 的方式讓程式再開一個 thread 去執行。</p><h3>後記</h3><p>在專案的收尾階段，終於把四篇的內容打完了，不過因為 Unity 的機制，async 的功能其實是不完整的，之後有時間的話想寫一個 Unity Job System 還有 UniTask 的研究東西…希望有那個時間吧哈哈。</p><p>不過忽然想到一件事，想稍微提一下有關 AI 的事情。</p><p>最近總是有很多的文章再說 ChatGPT 的事情，而我自己想到的是下面 Podcast 的內容，有興趣可以聽聽看。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fopen.spotify.com%2Fembed%2Fepisode%2F3UMwchTpQpUb6VxtGQK9ti%3Futm_source%3Doembed&amp;display_name=Spotify&amp;url=https%3A%2F%2Fopen.spotify.com%2Fepisode%2F3UMwchTpQpUb6VxtGQK9ti&amp;image=https%3A%2F%2Fi.scdn.co%2Fimage%2Fab67656300005f1fff99588cfe8729dbe93f2b00&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=spotify" width="456" height="152" frameborder="0" scrolling="no"><a href="https://medium.com/media/080ca19f29018867debb8b9cd4ae85b2/href">https://medium.com/media/080ca19f29018867debb8b9cd4ae85b2/href</a></iframe><p>我對於未來有更方便的工具可以協助我寫程式非常樂觀其成，因為我自己其實不喜歡處理那些太過繁瑣的程式處理，有了這種更方便的工具，就可以將時間更注重於分析新技術的優劣與使用，還有整體架構的處理。而且以遊戲體驗來說將來肯定能讓遊戲的遊玩體驗更加的豐富，想到這樣的未來就覺得很興奮。</p><h3>相關系列文章連結</h3><p>待補</p><h3>參考資料</h3><ul><li><a href="https://stackoverflow.com/questions/1934715/difference-between-a-coroutine-and-a-thread">Difference between a &quot;coroutine&quot; and a &quot;thread&quot;?</a></li><li><a href="https://blog.csdn.net/avi9111/article/details/121753627">彻底搞明白Unity-async-task特性_unity async_avi9111的博客-CSDN博客</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3b42f9ddfa0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Thread and Coroutine]]></title>
            <link>https://medium.com/@Tina70245/thread-and-coroutine-1fbe44694833?source=rss-94ee633c7f10------2</link>
            <guid isPermaLink="false">https://medium.com/p/1fbe44694833</guid>
            <category><![CDATA[threads]]></category>
            <category><![CDATA[coroutine]]></category>
            <category><![CDATA[unity]]></category>
            <dc:creator><![CDATA[Tina]]></dc:creator>
            <pubDate>Fri, 02 Jun 2023 10:01:35 GMT</pubDate>
            <atom:updated>2023-06-02T10:01:35.479Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduce</h3><p>Previously, when working on the game “Clency And Livia,” I encountered Coroutines for the first time and was initially confused about its parallel execution functionality. I was puzzled as to why it would move on to the next line of code before completing the judgment within the specified range. In the current VR project, I faced the issue of frame rate drops when directly consuming too many main thread resources while connecting to GCP. To avoid this, I needed to use the async writing style of threads to prevent the game from lagging. The following will explain the differences between Thread and Coroutine, as well as their usage in Unity.</p><h3>Thread and Coroutine</h3><p>Thread and Coroutine are both programming concepts that facilitate asynchronous operations, but they have several key differences:</p><p>1. Execution Method: Threads are independent programs scheduled by the operating system, running in their own separate space. Coroutines, on the other hand, are controlled actively within the code and can switch between different blocks within the same thread.</p><p>2. Resource Consumption: Each Thread requires additional resources to maintain its execution state. In comparison, Coroutines have lower resource consumption because they share resources within the same thread and have smaller switching overhead.</p><p>3. Synchronization: Threads can execute multiple tasks simultaneously, with each task running in a separate program, enabling true parallel processing. Coroutines, on the other hand, are based on cooperative multitasking and require manual release of control at appropriate points in order to switch to other Coroutines.</p><p>Threads provide true parallel processing capabilities but require additional resources when using multiple threads, and synchronization may be necessary to ensure data consistency. Coroutines provide a lightweight asynchronous processing mechanism with greater control flexibility during execution.</p><h3>Usage in Unity</h3><p>In Unity, it is encouraged to use Coroutines, commonly implemented as IEnumerator methods, which run on the main thread.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*1Xnk-UF5caUxvmx6FF7E5Q.png" /></figure><p>In fact, Unity now also provides the Job System as an asynchronous option. You can refer to the link below for more information.</p><p><a href="https://medium.com/akatsuki-taiwan-technology/unity-%E5%88%A9%E7%94%A8c-job-system%E8%88%87burst-compiler%E4%BE%86%E8%A7%A3%E6%94%BEcpu%E7%9A%84%E6%95%88%E8%83%BD-c9447357a076">[Unity]利用C# Job System與Burst Compiler來解放CPU的效能</a></p><p>In this VR project, to avoid lagging caused by handling microphone audio data updates or waiting for text-based content to be returned, it is necessary to use Thread’s async approach to execute code on a separate thread instead of passing everything through the main thread.</p><h3>Closing Thoughts</h3><p>As the project is coming to an end, I finally finished all four articles. However, due to Unity’s mechanisms, the functionality of async is incomplete. If I have time in the future, I would like to write about Unity Job System and UniTask for further research… Hopefully, I will have the time for that, haha.</p><p>On another note, I wanted to briefly mention something about AI.<br>There have been many articles recently discussing ChatGPT, and it reminded me of the content in the podcast below. If you’re interested, you can give it a listen.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fopen.spotify.com%2Fembed%2Fepisode%2F3UMwchTpQpUb6VxtGQK9ti%3Futm_source%3Doembed&amp;display_name=Spotify&amp;url=https%3A%2F%2Fopen.spotify.com%2Fepisode%2F3UMwchTpQpUb6VxtGQK9ti&amp;image=https%3A%2F%2Fi.scdn.co%2Fimage%2Fab67656300005f1fff99588cfe8729dbe93f2b00&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=spotify" width="456" height="152" frameborder="0" scrolling="no"><a href="https://medium.com/media/080ca19f29018867debb8b9cd4ae85b2/href">https://medium.com/media/080ca19f29018867debb8b9cd4ae85b2/href</a></iframe><p>I am optimistic about the future availability of more convenient tools to assist with programming. Personally, I don’t enjoy dealing with overly cumbersome programming tasks. With more convenient tools, I can focus more on analyzing the pros and cons of new technologies, their utilization, and overall architecture. Moreover, in terms of game experience, these tools will undoubtedly enrich the gameplay. The thought of such a future is quite exciting.</p><p>Related Series Article Links:<br>To be added.</p><h3>References</h3><ul><li><a href="https://stackoverflow.com/questions/1934715/difference-between-a-coroutine-and-a-thread">Difference between a &quot;coroutine&quot; and a &quot;thread&quot;?</a></li><li><a href="https://blog.csdn.net/avi9111/article/details/121753627">彻底搞明白Unity-async-task特性_unity async_avi9111的博客-CSDN博客</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1fbe44694833" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unity And Yarn Spinner]]></title>
            <link>https://medium.com/@Tina70245/unity-and-yarn-spinner-9ef0d9e5681c?source=rss-94ee633c7f10------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ef0d9e5681c</guid>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[yarn-spinner]]></category>
            <dc:creator><![CDATA[Tina]]></dc:creator>
            <pubDate>Thu, 01 Jun 2023 10:01:11 GMT</pubDate>
            <atom:updated>2023-06-01T10:01:11.511Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduce</h3><p>In Taiwan, the popular choice for dialogue plugin seems to be Fungus. However, because I played a game that used Yarn Spinner and liked its dialogue writing style, I decided to use this plugin for my school’s VR project. Here, I will briefly document the usage of this plugin.</p><h3>Basic Dialogue Writing</h3><p>Yarn Spinner primarily consists of nodes, lines, and options. The writing format is as follows:</p><pre>title: TestDialogue // One title represents one node<br>position: -89,-181<br>---<br>Bob: So can Yarn Spinner jump back to this dialogue? // Each line represents one line of dialogue<br>-&gt; Clicking this will jump to the previously displayed dialogue // -&gt; serves as an option, and options at the same indentation level will be displayed together<br>    Alice: Let&#39;s jump back to the previous question<br>    &lt;&lt;jump TestDialogue&gt;&gt; // The jump command allows jumping to the next node<br>-&gt; Clicking this will proceed to the next line<br>    Alice: Let&#39;s proceed to the next line<br>Alice: This is the next paragraph<br>&lt;&lt;jump TestDialogue2&gt;&gt;<br><br>===<br><br>title: TestDialogue2<br>position: -75,21<br>---<br>Alice: This is TestDialogue2<br><br>===</pre><p>In Visual Studio Code, clicking “Show Graph” allows you to see the relationships between each node. The following image represents the graph of node connections.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*nHnvSopgI5QsO8mabluZSQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/373/1*Gjb6RDYQSeJGhicq-nLJcg.png" /></figure><h3>Parameter Setup and Retrieval</h3><p>If you want to set values for certain text, you can use the <strong>&lt;&lt;set $name to variable&gt;&gt;</strong> format and use <strong>{$money}</strong> to display the value.</p><pre>title: TestDialogue<br>position: -89,-181<br>---<br>&lt;&lt;set $money to 35&gt;&gt; // Setting the value<br>Bob: So can Yarn Spinner jump back to this dialogue?<br>-&gt; Clicking this will jump to the previously displayed dialogue<br>    Alice: Let&#39;s jump back to the previous question<br>    Alice: How much money do you have?<br>    &lt;&lt;jump TestDialogue&gt;&gt;<br>-&gt; Clicking this will proceed to the next line<br>    Alice: Let&#39;s proceed to the next line<br>-&gt; {$money} // {} displays the content<br>    Alice: So you have {$money} money<br>Alice: This is the next paragraph<br>&lt;&lt;jump TestDialogue2&gt;&gt;<br><br>===<br>title: TestDialogue2<br>position: -75,21<br>---<br>Alice: This is TestDialogue2<br><br>===</pre><p><strong>InMemoryVariableStorage </strong>allows access to the values in the text.</p><pre>public class YarnSpinnerCommandController : MonoBehaviour<br>{<br>    [SerializeField] private InMemoryVariableStorage inMemoryVariableStorage;<br><br>    public void GetMoney()<br>    {<br>        inMemoryVariableStorage.TryGetValue(&quot;$money&quot;, out float money);<br>    }<br>}</pre><h3>Yarn Command</h3><p>Use YarnCommand to allow Yarn text to access program data.</p><pre>public class YarnSpinnerCommandController : MonoBehaviour<br>{<br>    [YarnCommand(&quot;show_money_info&quot;)] // Corresponds to the command in the Yarn text<br>    public static void ShowMoney()<br>    {<br>        // Some code to display the money<br>    }<br><br>    public void GetMoney()<br>    {<br>        inMemoryVariableStorage.TryGetValue(&quot;$money&quot;, out float money);<br>    }<br>}</pre><p>By entering the corresponding Yarn command name and parameters in the text, you can use it.</p><pre>title: TestDialogue<br>position: -89,-181<br>---<br>&lt;&lt;set $money to 35&gt;&gt; // Setting the value<br>Bob: So can Yarn Spinner jump back to this dialogue?<br>-&gt; Clicking this will jump to the previously displayed dialogue<br>    Alice: Let&#39;s jump back to the previous question<br>    Alice: How much money do you have?<br>&lt;&lt;jump TestDialogue&gt;&gt;<br>-&gt; Clicking this will proceed to the next line<br>    Alice: Let&#39;s proceed to the next line<br>-&gt; {$money} // {} can display content<br>    Alice: So you have {$money} money<br>Alice: This is the next paragraph<br>&lt;&lt;jump TestDialogue2&gt;&gt;<br><br>===<br>title: TestDialogue2<br>position: -75,21<br>---<br>Alice: This is TestDialogue2<br>&lt;&lt;show_money_info&gt;&gt;<br><br>===</pre><p>After setting the relevant values in DialogueRunner, you can run the text. This method is used to trigger text when the player enters a specific area.</p><pre>public class DialogueTrigger : MonoBehaviour<br>{<br>    [SerializeField] private string m_TalkToNode;<br><br>    private void OnTriggerEnter(Collider other)<br>    {<br>        StartDialogue();<br>    }<br><br>    public void StartDialogue()<br>    {<br>        FindObjectOfType&lt;DialogueRunner&gt;().StartDialogue(m_TalkToNode);<br>    }<br>}</pre><p>Related Series Article Links:</p><p>To be added.</p><h3>References</h3><ul><li><a href="https://yarnspinner.dev/">Yarn Spinner</a></li><li><a href="https://docs.yarnspinner.dev/using-yarnspinner-with-unity/creating-commands-functions">Commands and Functions</a></li><li><a href="https://docs.yarnspinner.dev/getting-started/writing-in-yarn/lines-nodes-and-options">Nodes, Lines, and Options</a></li><li><a href="https://docs.yarnspinner.dev/getting-started/writing-in-yarn/logic-and-variables">Variables</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ef0d9e5681c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[對話插件 Yarn Spinner 使用紀錄]]></title>
            <link>https://medium.com/@Tina70245/%E5%B0%8D%E8%A9%B1%E6%8F%92%E4%BB%B6-yarn-spinner-%E4%BD%BF%E7%94%A8%E7%B4%80%E9%8C%84-99803fa14767?source=rss-94ee633c7f10------2</link>
            <guid isPermaLink="false">https://medium.com/p/99803fa14767</guid>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[yarn-spinner]]></category>
            <dc:creator><![CDATA[Tina]]></dc:creator>
            <pubDate>Thu, 01 Jun 2023 10:01:11 GMT</pubDate>
            <atom:updated>2023-12-22T05:07:50.440Z</atom:updated>
            <content:encoded><![CDATA[<h3>前言</h3><p>在台灣好像比較主流使用的對話插件是 Fungus，不過因為玩過的一款遊戲有使用到此插件，也比較喜歡這個插件的對話寫法，所以學校 VR 專案就決定用這個插件做了，這邊簡單紀錄此插件的用法。</p><h3>基本對話寫法</h3><p>Yarn Spinner 是以 Nodes, Lines, and Options 為主要組成，寫法如下。</p><pre>title: TestDialogue //一個 title 為一個 Node<br>position: -89,-181<br>---<br>Bob: 所以 Yarn Spinner可以跳回此對話顯示嗎? //每一行句子為一個 Line<br>-&gt; 點這個會跳到剛剛顯示的對話 //-&gt; 做為一個 Option，在同一縮排的 Option會列在同一處<br>    Alice: 讓我們跳回剛剛的詢問吧<br>    &lt;&lt;jump TestDialogue&gt;&gt; //jump 指令可以跳到下一個 Node<br>-&gt; 點這個進行到下一句<br>    Alice: 讓我們進行到下一句吧<br>Alice: 這是下一段<br>&lt;&lt;jump TestDialogue2&gt;&gt;<br><br>===<br><br>title: TestDialogue2<br>position: -75,21<br>---<br>Alice: 這是TestDialogue2<br><br>===</pre><p>在 Visual Studio Code 中，點擊 Show Graph 可以看見每個 Node 間的關聯</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*nHnvSopgI5QsO8mabluZSQ.png" /></figure><p>下圖即為 Node 的關聯圖表示</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/373/1*Gjb6RDYQSeJGhicq-nLJcg.png" /></figure><h3>參數設定與獲取</h3><p>而要是想要有些文本數值的設定，則可以用 <strong>&lt;&lt;set $name to variable&gt;&gt;</strong>的方式去寫，並用 <strong>{$money}</strong> 讓值顯示</p><pre>title: TestDialogue<br>position: -89,-181<br>---<br>&lt;&lt;set $money to 35&gt;&gt; //設定數值<br>Bob: 所以 Yarn Spinner可以跳回此對話顯示嗎?<br>-&gt; 點這個會跳到剛剛顯示的對話<br>    Alice: 讓我們跳回剛剛的詢問吧<br>    Alice: 你有多少錢?<br>    &lt;&lt;jump TestDialogue&gt;&gt;<br>-&gt; 點這個進行到下一句<br>    Alice: 讓我們進行到下一句吧<br>-&gt; {$money} //{}可以顯示內容<br>    Alice: 原來你有 {$money} 錢<br>Alice: 這是下一段<br>&lt;&lt;jump TestDialogue2&gt;&gt;<br><br>===<br><br>title: TestDialogue2<br>position: -75,21<br>---<br>Alice: 這是TestDialogue2<br><br>===</pre><p>而<strong>InMemoryVariableStorage</strong> 可以得到文本裡的值</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/1*alk4WxwwPv_O0Miv1K-wgA.png" /></figure><pre>public class YarnSpinnerCommandController : MonoBehaviour<br>{<br><br>    [SerializeField] private InMemoryVariableStorage inMemoryVariableStorage;<br><br>    public void GetMoney()<br>    {<br>        inMemoryVariableStorage.TryGetValue(&quot;$money&quot;, out float money);<br>    }<br>}</pre><h3>Yarn command 的使用</h3><p>使用 <strong>YarnCommand</strong> 來讓 Yarn 的文本可以讀取程式資料。</p><pre>public class YarnSpinnerCommandController : MonoBehaviour<br>{<br>    [YarnCommand(&quot;show_money_info&quot;)] //會對應到 yarn 文本的指令<br>    public static void ShowMoney()<br>    {<br>        //一些顯示 Money 的程式<br>    }<br><br><br>    public void GetMoney()<br>    {<br>        inMemoryVariableStorage.TryGetValue(&quot;$money&quot;, out float money);<br>    }<br>}</pre><p>只要在文本打進相對應的 yarn command 名稱與參數，就可以使用。</p><pre>title: TestDialogue<br>position: -89,-181<br>---<br>&lt;&lt;set $money to 35&gt;&gt; //設定數值<br>Bob: 所以 Yarn Spinner可以跳回此對話顯示嗎?<br>-&gt; 點這個會跳到剛剛顯示的對話<br>    Alice: 讓我們跳回剛剛的詢問吧<br>    Alice: 你有多少錢?<br>    &lt;&lt;jump TestDialogue&gt;&gt;<br>-&gt; 點這個進行到下一句<br>    Alice: 讓我們進行到下一句吧<br>-&gt; {$money} //{}可以顯示內容<br>    Alice: 原來你有 {$money} 錢<br>Alice: 這是下一段<br>&lt;&lt;jump TestDialogue2&gt;&gt;<br><br>===<br><br>title: TestDialogue2<br>position: -75,21<br>---<br>Alice: 這是TestDialogue2<br>&lt;&lt;show_money_info&gt;&gt;<br><br>===</pre><p>之後只要在 <strong>DialogueRunner</strong>設定好相關數值，就可以跑文本了，這邊是用這種做法去做當玩家到範圍時的文本觸發。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*qB6F9P1WRWggAGy0I7x0zQ.png" /></figure><pre>public class DialogueTrigger : MonoBehaviour<br>{<br>    [SerializeField] private string m_TalkToNode;<br><br>    private void OnTriggerEnter(Collider other)<br>    {<br>        StartDialouge();<br>    }<br><br>    public void StartDialouge()<br>    {<br>        FindObjectOfType&lt;DialogueRunner&gt;().StartDialogue(m_TalkToNode);<br>    }<br>}</pre><h3>範例</h3><p>除此之外還有些官方範例可以參考</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oQ2YAkMpDhZlp2HPrENgwA.png" /></figure><h3>相關系列文章連結</h3><p>待補</p><h3>參考資料</h3><ul><li><a href="https://yarnspinner.dev/">Yarn Spinner</a></li><li><a href="https://docs.yarnspinner.dev/using-yarnspinner-with-unity/creating-commands-functions">Commands and Functions</a></li><li><a href="https://docs.yarnspinner.dev/getting-started/writing-in-yarn/lines-nodes-and-options">Nodes, Lines, and Options</a></li><li><a href="https://docs.yarnspinner.dev/getting-started/writing-in-yarn/logic-and-variables">Variables</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99803fa14767" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SteamVR 使用紀錄]]></title>
            <link>https://medium.com/@Tina70245/steamvr-%E4%BD%BF%E7%94%A8%E7%B4%80%E9%8C%84-4bd42d4898d4?source=rss-94ee633c7f10------2</link>
            <guid isPermaLink="false">https://medium.com/p/4bd42d4898d4</guid>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[steam]]></category>
            <category><![CDATA[vr]]></category>
            <dc:creator><![CDATA[Tina]]></dc:creator>
            <pubDate>Wed, 31 May 2023 10:02:29 GMT</pubDate>
            <atom:updated>2023-05-31T10:02:29.461Z</atom:updated>
            <content:encoded><![CDATA[<h3>SteamVR 介紹</h3><p>SteamVR 是一個由 Valve Corporation 開發的虛擬實境（VR）軟體平台。它提供了許多功能和工具，用於虛擬實境體驗的開發和管理。這些功能包括追蹤和定位、手部和控制器追蹤、空間音效、動作回饋等。開發者可以使用 SteamVR 的開發套件（SDK）來創建各種虛擬實境應用程式，例如遊戲、模擬器、教育應用程式等。</p><h3>PC 與 VR 環境設定</h3><p>畢竟是 Steam 提供的 API ，所以要使用的話會需要下載官方的 Steam 才能使用</p><p><a href="https://store.steampowered.com/about/">Steam, The Ultimate Online Game Platform</a></p><p>這兩張圖片的設定要開起來，不然 VR 設備不會開起來</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/0*kLG2kk52mGI4rk01.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/0*zMkTUaEBDF_4Z-Gt.png" /></figure><h3>實際案例</h3><p><strong>TeleportArea.cs</strong><br>用來設定VR移動範圍的地方</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/0*PDAb15UpvHyx7s33.png" /></figure><p>在遊玩畫面，玩家控制手把時，會顯示一個拋物線移動提示來確認自已可以移動的範圍。</p><p><strong>Player.cs</strong></p><p>連接其他程式操作的主程式，要有這個才能有可以操作的角色。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/347/0*kY_H98uxN7AkUFwv.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*ZZg7wD8SUej6bvjLLZ4Dpg.png" /></figure><p><strong>Interactable.cs</strong><br>用來讓悠遊卡可以被使用的地方。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/1*221hllVpVx3UN6UfnpFWvA.png" /></figure><p>效果呈現如圖，有此程式的物件會呈現黃色框框。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pw5K3-CcKq3yqFM05fCHhQ.png" /></figure><p><strong>Throwable.cs</strong><br>有綁在悠遊卡上的程式，要用這個物件才能被拿起與丟擲。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/1*ZyfsGfQ7NeIaEJh9aB_UXQ.png" /></figure><p>效果呈現如圖，可以將物件拿起來。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*_Mtsm_18khn91w-KH5g-YQ.png" /></figure><h3>相關系列文章連結</h3><p>待補</p><h3>參考資料</h3><ul><li><a href="https://store.steampowered.com/app/250820/SteamVR/?l=tchinese">SteamVR on Steam</a></li><li><a href="https://valvesoftware.github.io/steamvr_unity_plugin/">SteamVR Unity Plugin</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4bd42d4898d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unity And SteamVR]]></title>
            <link>https://medium.com/@Tina70245/unity-and-steamvr-c7ee57e00475?source=rss-94ee633c7f10------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7ee57e00475</guid>
            <category><![CDATA[vr]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[steam]]></category>
            <dc:creator><![CDATA[Tina]]></dc:creator>
            <pubDate>Wed, 31 May 2023 10:02:19 GMT</pubDate>
            <atom:updated>2023-05-31T10:02:19.633Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction to SteamVR</h3><p>SteamVR is a virtual reality (VR) software platform developed by Valve Corporation. It offers a wide range of features and tools for the development and management of VR experiences. These features include tracking and positioning, hand and controller tracking, spatial audio, haptic feedback, and more. Developers can utilize the SteamVR development kit (SDK) to create various VR applications, such as games, simulators, educational apps, and more.</p><h3>PC and VR Environment Setup</h3><p>Since SteamVR is an API provided by Steam, you will need to download the official Steam client to use it.</p><p><a href="https://store.steampowered.com/about/">Steam, The Ultimate Online Game Platform</a></p><p>The settings in the two images below need to be enabled; otherwise, the VR devices will not function properly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/0*kLG2kk52mGI4rk01.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*zMkTUaEBDF_4Z-Gt.png" /></figure><h3>Project Use</h3><p><strong>TeleportArea.cs</strong><br>Used to set the VR movement area. In the gameplay view, when the player controls the controller, a parabolic movement indicator is displayed to confirm the available movement range.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/0*PDAb15UpvHyx7s33.png" /></figure><p><strong>Player.cs</strong><br>The main script that connects and operates other programs. This is necessary to have a controllable character.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/347/0*kY_H98uxN7AkUFwv.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*ZZg7wD8SUej6bvjLLZ4Dpg.png" /></figure><p><strong>Interactable.cs</strong><br>Used to enable the usage of the “悠遊卡” (a transportation card commonly used in Taiwan) in the VR environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/1*221hllVpVx3UN6UfnpFWvA.png" /></figure><p>Objects with this script will be highlighted with a yellow frame.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pw5K3-CcKq3yqFM05fCHhQ.png" /></figure><p><strong>Throwable.cs</strong></p><p>Attached to the “悠遊卡” object, this script allows the object to be picked up and thrown.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/1*ZyfsGfQ7NeIaEJh9aB_UXQ.png" /></figure><p>The object can be lifted as shown in the image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*_Mtsm_18khn91w-KH5g-YQ.png" /></figure><p>Related Series Article Links:<br>To be added.</p><h3>References</h3><ul><li><a href="https://store.steampowered.com/app/250820/SteamVR/?l=tchinese">SteamVR on Steam</a></li><li><a href="https://valvesoftware.github.io/steamvr_unity_plugin/">SteamVR Unity Plugin</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7ee57e00475" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unity Google cloud platform(GCP)使用紀錄]]></title>
            <link>https://medium.com/@Tina70245/unity-google-cloud-platform-gcp-%E4%BD%BF%E7%94%A8%E7%B4%80%E9%8C%84-4a7c61bfd?source=rss-94ee633c7f10------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a7c61bfd</guid>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[unity]]></category>
            <dc:creator><![CDATA[Tina]]></dc:creator>
            <pubDate>Tue, 30 May 2023 10:02:13 GMT</pubDate>
            <atom:updated>2023-05-30T10:02:13.340Z</atom:updated>
            <content:encoded><![CDATA[<h3>前言</h3><p>因為想把製作學校的 VR 專題過程中的記錄下來，所以決定寫幾篇文章。不過這幾篇的內容都比較零碎，所以參考性不太高，請注意。</p><h3>什麼是 Google cloud platform(GCP)?</h3><p>Google Cloud Platform（GCP）是由 Google 提供的一個全球性的雲端計算平台。它提供了一系列的雲端服務，包括虛擬機器（VM）實例、儲存、資料庫、語音辨識、機器學習、網路、分析和開發工具等。而這次專案主要使用的是語音辨識的部分。</p><h3>什麼是 NuGet?</h3><p>NuGet 是一個開放原始碼的套件管理系統，用於微軟的.NET 平台。它允許開發人員輕鬆地將和共享程式庫、工具和其他相關的代碼封裝成可重複使用的套件，並成為.NET 開發中非常常用的套件管理工具。</p><h3>怎麼獲取 NuGet 的程式庫?</h3><p>在 Visual Studio 中，可以從 Project/Manager NuGet Packages 去開啟 NuGet 的介面。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/0*j0Z0NywzANjBHoDZ.png" /></figure><p>接著就可以操作此介面去安裝相關程式庫。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OvAMXCITrSxf1wgm.png" /></figure><p>這次的案例是以 Visual Studio 為主，不過市面上有名的 IDE 應該都有提供此介面可以操作。</p><h3>GCP 服務的設定</h3><p>想要啟用 GCP，必須要設定信用卡與服務帳戶。</p><p>首先要到帳單/付款方式去設定信用卡資訊。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/0*Yya_wCgt8S8E7UK5.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/366/0*jwMNaUKRbW86ubQ9.png" /></figure><p>再來去服務帳戶建立服務帳戶，設定好相關設定後點選動作-&gt;管理金鑰產生新的金鑰。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3qzeCjBBMK-2e60g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/0*pGM8TPOQ4XLhvJbS.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/367/0*LTtTUjgC_xJ6XP2F.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/0*mueZt3-NBkNruvyf.png" /></figure><p>建立了之後會會產生一個 Json 檔，此資料會直接連接到 GCP 平台的設定，絕對不能洩漏出去。以本人我的一個案例，當時我上傳 GitHub，就忘記要處理這金鑰，結果就被一個爬蟲爬到並盜用服務，還好當時還在試用期間所以花費的金錢都是 GCP 提供的，不然就要出事了…。</p><p>實際上服務帳戶的權限設定也能阻止這類事情發生，有興趣可以去翻看看相關資料。</p><h3>Google cloud 串接程式</h3><p>以下 VR 專案用來呼叫 Google 程式的程式碼，來自下方連接的內容，這邊只說明有用到的相關程式用法說明。</p><ul><li><a href="https://github.com/ActiveNick/Unity-Text-to-Speech">GitHub - ActiveNick/Unity-Text-to-Speech: Sample app used to demonstrate the use of Microsoft Cognitive Services Text-to-Speech APIs (aka Speech Synthesis) from within Unity.</a></li><li><a href="https://github.com/oshoham/UnityGoogleStreamingSpeechToText">GitHub - oshoham/UnityGoogleStreamingSpeechToText: A Unity plugin for real-time, indefinite speech-to-text transcription from a microphone using Google Cloud Speech-to-Text.</a></li></ul><h4>主要引用到的資源</h4><pre>using Google.Cloud.Speech.V1;<br>using Google.Cloud.TextToSpeech.V1;<br>using Google.Protobuf;<br>using Grpc.Core;</pre><p><strong>Google.Cloud.Speech.V1</strong></p><p>這是 Google Cloud Speech-to-Text (語音轉文字) 的服務。可以在程式碼中直接使用該命名空間中的類別和方法，例如 <strong>SpeechClient</strong>，詳細後面說。</p><p><strong>Google.Cloud.TextToSpeech.V1</strong></p><p>這是 Google Cloud Text-to-Speech (文字轉語音) 的服務，詳細後面說。</p><p><strong>Google.Protobuf</strong></p><p>這是一種開源跨平台的序列化資料結構的協定。其中 <strong>ByteString</strong>是一個用於表示二進位資料的類別。</p><p><strong>Grpc.Core</strong></p><p>這是 Google 的通用遠端程序呼叫 (gRPC) 函式庫的一部分，用於實現跨網路的服務間通信。能夠在程式碼中使用 gRPC 相關的類別和方法，例如 <strong>Channel</strong>，用於建立與服務器的通信通道。</p><h4>GoogleCloud 環境設定</h4><p><strong>Environment.SetEnvironmentVariable</strong></p><p><strong>Environment.SetEnvironmentVariable</strong>是一個用於在程式執行期間設定或變更環境變數的方法。環境變數是一些在操作系統中設定的值，它們可以影響程式的行為或提供程式所需的配置資訊。不過這邊環境變數的作用範圍僅限於當前的程式執行期間，並不會永久影響操作系統或其他程式。</p><h4>語音轉文字</h4><p><strong>OnAudioFilterRead</strong></p><p><strong>OnAudioFilterRead </strong>函數是 Unity 提供的一個功能，用於聲音的過濾和處理。當 Unity 遊戲引擎播放音訊時，它會調用 <strong>OnAudioFilterRead</strong> ，並將聲音傳遞給該 function 。可以在這個 function 中執行特定的音訊處理，在這邊是用來獲取玩家說話內容的資料，並在後面處理成 <strong>ByteString</strong>。</p><p><strong>SpeechClient</strong></p><p><strong>SpeechClient</strong>可以建立與Speech-to-Text 服務的連線，並使用其提供的功能進行音訊辨識。以下是<strong>SpeechClient</strong> 的方法，在此用法中<strong>StreamingRecognize</strong>用來建立與 Google Cloud Speech-to-Text 服務的串流連線，實現即時的音訊串流辨識。</p><p><strong>StreamingRecognitionResult</strong></p><p>當使用Speech-to-Text 的串流辨識功能時，每次向服務傳送音訊時，服務會返回一個 <strong>StreamingRecognitionResult</strong> 物件，該物件包含了對音訊的即時辨識結果。</p><p><strong>ByteString</strong></p><p><strong>ByteString</strong> 是一個 GCP 函式庫中的類別，用於表示二進位資料的字串。它提供了對二進位資料的有效處理方法，例如串接、切割和比較等。在 GCP 的許多服務中，如語音辨識和影像處理等，使用 <strong>ByteString</strong> 可以方便地處理和傳輸二進位資料。</p><h4>文字轉語音</h4><p><strong>TextToSpeechClient</strong></p><p><strong>TextToSpeechClient</strong> 提供了一個介面，可以將文字轉換為語音。並指定要生成的語音的語言、聲音樣式和語速等參數，將文字請求傳送到 Text-to-Speech 服務進行處理。最終可以取得生成的語音檔案或透過串流傳送回應。</p><p><strong>VoiceSelectionParams</strong></p><p><strong>VoiceSelectionParams</strong> 是用於指定要生成的語音的參數。透過 <strong>VoiceSelectionParams</strong>，可以選擇語音的語言、性別、音調和語速等。</p><p><strong>AudioConfig</strong></p><p><strong>AudioConfig</strong> 用於指定語音合成的音訊設定。</p><h3>相關系列文章連結</h3><p>待補</p><h3>參考資料</h3><ul><li><a href="https://github.com/ActiveNick/Unity-Text-to-Speech">GitHub - ActiveNick/Unity-Text-to-Speech: Sample app used to demonstrate the use of Microsoft Cognitive Services Text-to-Speech APIs (aka Speech Synthesis) from within Unity.</a></li><li><a href="https://github.com/oshoham/UnityGoogleStreamingSpeechToText">GitHub - oshoham/UnityGoogleStreamingSpeechToText: A Unity plugin for real-time, indefinite speech-to-text transcription from a microphone using Google Cloud Speech-to-Text.</a></li><li><a href="https://learn.microsoft.com/zh-tw/dotnet/api/system.environment.setenvironmentvariable?view=net-8.0">Environment.SetEnvironmentVariable 方法 (System)</a></li><li><a href="https://cloud.google.com/text-to-speech?hl=zh-tw">Text-to-Speech：自然流暢的語音合成服務 | Cloud Text-to-Speech API | Google Cloud</a></li><li><a href="https://cloud.google.com/speech-to-text?hl=zh-tw">Speech-to-Text：自動語音辨識 | Google Cloud</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a7c61bfd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unity And GCP]]></title>
            <link>https://medium.com/@Tina70245/unity-and-gcp-a42ee29f59d2?source=rss-94ee633c7f10------2</link>
            <guid isPermaLink="false">https://medium.com/p/a42ee29f59d2</guid>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[unity]]></category>
            <dc:creator><![CDATA[Tina]]></dc:creator>
            <pubDate>Tue, 30 May 2023 10:02:13 GMT</pubDate>
            <atom:updated>2023-05-30T10:02:13.278Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Because I wanted to document the process of creating our school’s VR project, I decided to write a few articles. However, the content of these articles is somewhat fragmented, so please note that their reference value may be limited.</p><h3>What is Google Cloud Platform (GCP)?</h3><p>Google Cloud Platform (GCP) is a global cloud computing platform provided by Google. It offers a range of cloud services, including virtual machine (VM) instances, storage, databases, speech recognition, machine learning, networking, analytics, and development tools. The main focus of this project is the speech recognition component.</p><h3>What is NuGet?</h3><p>NuGet is an open-source package management system used for Microsoft’s .NET platform. It allows developers to easily package and share libraries, tools, and other related code for reusability, making it a commonly used package management tool in .NET development.</p><h3>How to obtain NuGet libraries?</h3><p>In Visual Studio, you can open the NuGet interface from Project/Manage NuGet Packages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/0*j0Z0NywzANjBHoDZ.png" /></figure><p>From there, you can operate within this interface to install the relevant libraries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OvAMXCITrSxf1wgm.png" /></figure><p>While this example mainly focuses on Visual Studio, most popular IDEs on the market should provide a similar interface for operation.</p><h3>GCP Settings</h3><p>To enable GCP, it is necessary to set up a credit card and service account.<br>Firstly, navigate to Billing/Payment Method to set up credit card information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*K0PvwgGPFYc63CH8gHsQRQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*psP2TTshBCaH6fRmVKfpSg.png" /></figure><p>Then, create a service account in the Service Accounts section, configure the relevant settings, and click on Actions -&gt; Manage Key to generate a new key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4-cdtcXDJwNprCbZ8IuNwQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/277/1*WkMO4Xm8SOArAXXMs2Sitg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*c27MEWq0lbpCOfEdEDsHRA.png" /></figure><p>Once created, a JSON file will be generated, which will directly link to the GCP platform’s configuration. It is absolutely crucial not to disclose this information. In a personal case, I mistakenly uploaded this key to GitHub, and it was discovered and misused by a crawler. Fortunately, at that time, I was still in the trial period, so the costs incurred were covered by GCP. Otherwise, it could have been a serious issue. In reality, proper permission settings for service accounts can also prevent such incidents from occurring. If interested, please refer to relevant documentation for further details.</p><h3>Integration of Google Cloud into the Program</h3><p>The following code is used in the VR project to invoke Google programs, as referenced in the connected content below. Only the relevant program usage explanations are provided here.</p><ul><li><a href="https://github.com/ActiveNick/Unity-Text-to-Speech">GitHub - ActiveNick/Unity-Text-to-Speech: Sample app used to demonstrate the use of Microsoft Cognitive Services Text-to-Speech APIs (aka Speech Synthesis) from within Unity.</a></li><li><a href="https://github.com/oshoham/UnityGoogleStreamingSpeechToText">GitHub - oshoham/UnityGoogleStreamingSpeechToText: A Unity plugin for real-time, indefinite speech-to-text transcription from a microphone using Google Cloud Speech-to-Text.</a></li></ul><p>Main resources referenced:</p><pre>using Google.Cloud.Speech.V1;<br>using Google.Cloud.TextToSpeech.V1;<br>using Google.Protobuf;<br>using Grpc.Core;</pre><p><strong>Google.Cloud.Speech.V1</strong></p><p>This is the service for Google Cloud Speech-to-Text, allowing direct usage of the classes and methods in this namespace in the code. For example, <strong>SpeechClient</strong> will be detailed below.<br><strong>Google.Cloud.TextToSpeech.V1</strong></p><p>This is the service for Google Cloud Text-to-Speech. Further details will be provided below.<br><strong>Google.Protobuf</strong></p><p>This is an open-source cross-platform protocol for serializing data structures. <strong>ByteString</strong> is a class used to represent binary data.<br><strong>Grpc.Core</strong></p><p>This is part of Google’s general Remote Procedure Call (gRPC) library, used for implementing inter-service communication across networks. It allows the usage of gRPC-related classes and methods in the code, such as <strong>Channel</strong> for establishing communication channels with servers.</p><h4>Google Cloud Environment</h4><p><strong>Environment.SetEnvironmentVariable</strong></p><p><strong>Environment.SetEnvironmentVariable </strong>is a method used to set or change environment variables during program execution. Environment variables are values set in the operating system that can affect program behavior or provide configuration information required by the program. However, the scope of these environment variables is limited to the current program execution and does not permanently affect the operating system or other programs.</p><h4>Speech-to-Text</h4><p><strong>OnAudioFilterRead</strong></p><p><strong>OnAudioFilterRead</strong> is a function provided by Unity for sound filtering and processing. When the Unity game engine plays audio, it invokes <strong>OnAudioFilterRead</strong> and passes the sound to that function. Specific audio processing can be performed within this function. In this case, it is used to retrieve data on the player’s spoken content and process it into a <strong>ByteString</strong> later on.</p><p><strong>SpeechClient</strong></p><p><strong>SpeechClient</strong> establishes a connection with the Speech-to-Text service and utilizes its functionalities for audio recognition. The following methods of <strong>SpeechClient </strong>are used in this scenario. <strong>StreamingRecognize </strong>is used to establish a streaming connection with the Google Cloud Speech-to-Text service for real-time audio streaming recognition.</p><p><strong>StreamingRecognitionResult</strong></p><p>When using the streaming recognition feature of Speech-to-Text, each time audio is sent to the service, a <strong>StreamingRecognitionResult </strong>object is returned, which contains real-time recognition results for the audio.</p><p><strong>ByteString</strong></p><p><strong>ByteString </strong>is a class within the GCP library used to represent binary data strings. It provides efficient methods for handling binary data, such as concatenation, splitting, and comparison. In many GCP services, such as speech recognition and image processing, <strong>ByteString </strong>is used for convenient handling and transmission of binary data.</p><h4>Text-to-Speech</h4><p><strong>TextToSpeechClient</strong></p><p><strong>TextToSpeechClient </strong>provides an interface for converting text into speech. You can specify parameters such as language, voice style, and speech rate for the generated speech and send text requests to the Text-to-Speech service for processing. Ultimately, you can obtain the generated audio file or stream it back as a response.</p><p><strong>VoiceSelectionParams</strong></p><p><strong>VoiceSelectionParams </strong>is used to specify parameters for the generated voice. Through <strong>VoiceSelectionParams</strong>, you can choose the language, gender, pitch, and speech rate of the voice.</p><p><strong>AudioConfig</strong></p><p><strong>AudioConfig</strong> is used to specify audio settings for speech synthesis.</p><h3>Related series of article links</h3><p>To be added.</p><h3>References</h3><ul><li><a href="https://github.com/ActiveNick/Unity-Text-to-Speech">GitHub - ActiveNick/Unity-Text-to-Speech: Sample app used to demonstrate the use of Microsoft Cognitive Services Text-to-Speech APIs (aka Speech Synthesis) from within Unity.</a></li><li><a href="https://github.com/oshoham/UnityGoogleStreamingSpeechToText">GitHub - oshoham/UnityGoogleStreamingSpeechToText: A Unity plugin for real-time, indefinite speech-to-text transcription from a microphone using Google Cloud Speech-to-Text.</a></li><li><a href="https://learn.microsoft.com/en-us/dotnet/api/system.environment.setenvironmentvariable?view=net-8.0">Environment.SetEnvironmentVariable Method (System)</a></li><li><a href="https://cloud.google.com/text-to-speech">Text-to-Speech: Lifelike AI Voices &amp; Speech Synthesis</a></li><li><a href="https://cloud.google.com/speech-to-text"></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a42ee29f59d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[如何在 Unity 裡寫出具有一定擴充性的遊戲(30)—感想與感謝]]></title>
            <link>https://medium.com/@Tina70245/%E5%A6%82%E4%BD%95%E5%9C%A8-unity-%E8%A3%A1%E5%AF%AB%E5%87%BA%E5%85%B7%E6%9C%89%E4%B8%80%E5%AE%9A%E6%93%B4%E5%85%85%E6%80%A7%E7%9A%84%E9%81%8A%E6%88%B2-30-%E6%84%9F%E6%83%B3%E8%88%87%E6%84%9F%E8%AC%9D-d2b16b542667?source=rss-94ee633c7f10------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2b16b542667</guid>
            <category><![CDATA[unity]]></category>
            <dc:creator><![CDATA[Tina]]></dc:creator>
            <pubDate>Wed, 17 May 2023 05:47:20 GMT</pubDate>
            <atom:updated>2023-05-17T05:48:01.198Z</atom:updated>
            <content:encoded><![CDATA[<h4>Day 30：感想與感謝</h4><p>註：本篇文章為本人於iT邦幫忙參與鐵人賽之系列文章，下為文章連結。</p><p><a href="https://ithelp.ithome.com.tw/articles/10306481">Day 30：感想與感謝 - iT 邦幫忙::一起幫忙解決難題，拯救 IT 人的一天</a></p><p>這種類型的文章寫作其實從學習了一段時間的Unity後就一直在想了，但以前覺得自己的實力一直都不太夠，寫這種文章還可能誤導人是不是不太好？結果就拖到現在要生出文章為止。</p><p>我希望這些文章是真的能幫助到那些想要讓程式碼的整潔度上升、甚至可以模組化的概念的人。當然如果看到這裡只覺得一片茫然的話，我跟你說…這很正常。</p><p>想當初我翻閱設計模式的書籍時，我也是很不解裡面的內容，只能依樣畫葫蘆的把高中時期的飛機射擊遊戲的程式碼重構一次…老實說依樣畫葫蘆也沒有很成功(我就爛)。但即使我們學習的過程中會遇到許多的障礙與困惑，但這都不妨礙我們為了寫出更好的程式架構來支撐起整個遊戲的決心。</p><p>不過說真的人不是完美的，所以理所當然設計模式和語言特性還有Unity引擎這些由人發明的方法也不是完美的，而比起去計較每個模式的差別作法，不如去思考如何跟其他人約定好這些程式的寫法怎麼寫才是最好的方式，畢竟要真的能寫出3A等級的大型遊戲話並不是一個大神可以生出整個架構，而是一群人互相約定與規範好相關架構設計方式，才能真的擁有能支撐最新技術的架構與能力。</p><p>希望大家在學習程式與創作遊戲的過程都可以找到屬於自己的道路，我們有緣再見～</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2b16b542667" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>