思元的開發筆記

關於 web service, unity, blogger 等軟體工程筆記

C++ Library callback using C# in Unity and cross thread call

在外部 C++ library callback 函數中,呼叫 StartCoroutine 而導致錯誤訊息 StartCoroutine can only be called from the main thread。該錯誤的原因範例專案建立,以及解決方案。

C# Array operations in Unity

整理一下 C# Array(陣列)的筆記,紀錄對陣列常用的操作。預設資料,列舉元素,新增元素,刪除移除元素,搜尋資料,轉換以及排序排列。想法是若需要使用程式對 Array 進行大量的資料操作,請改用 List 吧。

Unity5 Graphic raycastTarget default values

Unity GUI 大量的 UI 物件會使得 Graphic Raycaster 效能低落,因為要判斷該 Canvas 上許多的 Graphic 物件有沒有被 Ray 打到。主要的解決方案是減少判斷的 Graphic 物件。提供解決方案程式碼,自動在 Unity 新增新的 Graphic 後,設定新的 raycastTarget 屬性。

Unity5 Editor ReorderableList

Unity5 Editor ReorderableList 筆記,紀錄 ReorderableList 的使用範例程式碼,將原先 Array 編輯器,改成表格式的編輯器。最後展示一個包裝程式碼範例,能夠快速建立 ReorderableList,並且根據欄位(Fields)自動排版。