Collection of simple yet useful c# code snippets used in Unity
-
Color Concepts -Snippets: 1. Change Button Text and Image Color. 2. Toggle Button for Image Color Change
-
GameObject 1. Game Object Properties 2. Set gameObject.tag in script and retrieval of objects using tag 3. GetChild(i)
-
SetActive -Snippets: 1. Toggle Text and Toggle ONOFF
-
Text -Snippets: 1. Text UI
-
Toggle -Snippets: 1. Text Manipulation by Toggle 2. Text output depending on Toggle checked or unchecked
-
Methods,Invoke and Coroutines -Concepts and Snippets: 1. CoRoutines 2. Invoke
-
Misc -Concepts and Snippets: 1. Convert String to Int in Unity 2. Create and print Dictionary Values
-
Materials -Concepts: 1. Shader properties
-
Important Utilities and Concepts -Concepts and Snippets: 1. Unity- Create and Import Scriptable Object from Excel (Credit - Mikito Yoshiya) 2. Unity- Save Ingame Data 3. Serializable and Json Utility(Tip)
-
Events -Concepts and Snippets: 1. Unity - Events and Callbacks
-
Functionalities -Snippets 1. Unity- Change Plane Texture Dynamically in C# Script 2. Unity- Rotate characters with mouse 3. Unity- Rotate GameObject on touch 4. Unity- Team Selection Cycle Code