[Unity] Manual set Android NDK path when UnityHub Add Modules failed

1. Hack the NDK version number
Open file source.properties with a txt file Modify Pkg.Revision to your NDK target version number Pkg.Revision = 19.0.5232133
2. Fix NDK Signing
Open terminal, go to NDK root and execute the scripts to reset extended attribute and fix the signing.

Migrate Unity 2D Game to Cocos Creator

Overview
本文主要分享從 Unity 2D 小遊戲轉移到 Cocos Creator 上的一些心得。 1. Why? 2. 會遇到什麼問題? 3. 轉移要花多少時間? 4. C# => TypeScript 5. Unity => Cocos 6. 小結

[Unity] Jetbrains Rider 安裝與使用

Overview
1. Install Jetbrains Rider 2. Unity External Tools 3. Unity File Templates 4. Namespace 5. Find Usages 6. Code Vision 7. Typo Detection 8. Error Detection 9. Unity Serialized Field Naming 10. Terminal 11. Version Control 12. Code Style 13. Reformat Code on Save (Macros) 14. Renaming MonoBehaviour

[Unity] Performance Test – String Concat

Recommended to use string.Concat() or directly use + operator for better performance. Test times: 10,000,000 1. PlusOperator: 6825 2. Interpolation: 10037 3. StringFormat: 9940 4. StringConcat: 6822 5. StringJoin: 8255 6. StringBuilder: 7157

[Unity] 如何重新命名 Serialized Fields,不遺失原始資料?

Overview

命名曾經被程式設計師們列為,寫程式時最困難的事 當有用到的 Serialized Fields 需要重新命名時 GameObject 或 ScriptableObject 中的資料會遺失 範例情境 1. 原始設計:private member with public getter 2. 需求變更:private member with public getter & setter 3. 重構問題:將 private member 改為 public member,並移除多餘的 public getter & setter 解決方案 1. 直接使用文字編輯器打開 Prefab 或 ScriptableObject 2. 使用 [FormerlySerializedAs] attribute

[Unity] Performance Test – String Comparison

Overview
Recommended to use string.Equals() for better performance. Test times: 10,000,000 1. EqualityOperator: 464 2. StringEquals: 406 3. StringEqualsByIgnoreCase: 13557 4. AnimatorHash: 1614

[Unity] 如何測試函式執行時間?

使用 Unity Time 下的各種屬性,包含 time、deltaTime、fixedDeltaTime 只有在不同 Frame 才會有值 想要正確測試某個函式的時間,可以採用以下三種方法 值得一提的是,Stopwatch 似乎就是為了做這件事情而存在的
Overview
1. DateTime.Now 2. Environment.TickCount 3. System.Diagnostics.Stopwatch