Small Unity Cheat Sheet
Today We Discuss About
1. Basic Script Structure
2. Input Handling
3. Game Object Manipulation
4. Physics Interactions
5. Coroutines
1. Basic Script Structure
Explain:
- Script Class: Defines a script class that inherits from MonoBehaviour.
- Variables Declaration: Example of declaring a variable.
- Start(): Called before the first frame update, used for initialization.
- Update(): Called once per frame, used for continuous game logic.
2. Input Handling
Explain:
- Input.GetKeyDown(): Checks if a specific key (e.g., Space) is pressed.
- Input.GetAxis(): Retrieves the value of specified input axes (e.g., Horizontal, Vertical) for smooth input.
3. Game Object Manipulation
Explain:
- GameObject.Find(): Finds a GameObject by name.
- SetActive(): Enables or disables a GameObject.
- Instantiate(): Creates a new instance of a GameObject (e.g., a prefab).
- Destroy(): Removes a GameObject from the scene.
4. Physics Interactions
Explain:
- Rigidbody: Component for physics interactions (e.g., applying forces).
- GetComponent<Rigidbody>(): Retrieves the Rigidbody component.
- AddForce(): Applies a force to the Rigidbody.
- OnCollisionEnter(): Called when a collision occurs, used for collision handling.
5. Coroutines
Explain:
- Coroutine: A function that can pause its execution and yield control back to Unity.
- WaitForSeconds(): Delays the execution of code for a specified duration.
- StartCoroutine(): Starts the coroutine.
Some Good Youtube Channels For Improve Your Unity Skills
👇👇Some Coding Challenges You Can Try Now With My GitHub Repo
🧑💻Coding Challenge 05 🎮
Challenge -A game object can Rotate its own axis in the game (x or y or z) with using a small script.
👉https://github.com/praneeth724/CodingChallenge05.git
🧑💻Coding Challenge 07 🎮
Challenge-In this challenge we have two game objects.If one game object collide with other game object then the second game object will disappear,make a small sound and print console massage.
👉https://github.com/praneeth724/CodingChallenge07.git
🧑💻Coding Challenge 08 🎮
Challenge-In this Challenge Has main 3 Parts.This game have 2 gameobjects.They are player and powerup system.If the player collect Power Up Then It will destroy.Second one is the player speed increse a small time duration and last the player speed come to normal start value.
👉https://github.com/praneeth724/CodingChallenge08.git
🧑💻Coding Challenge 09 🎮
Challenge -In this challenge If we press space key then the game object will jump in the game.As well as again we click the space button it will not jump and it will jump only it position on the ground game object.
👉https://github.com/praneeth724/CodingChallenge09.git
🧑💻Coding Challenge 10 🎮
Challenge -In this challenge if the first game object will collide second game object then start a new scene
👉https://github.com/praneeth724/CodingChallenge10.git
My New 2D Super Mario Game Challenge Start and Watch My Channel For More Tutorials
👉👉https://youtube.com/@MR.KPBro1?si=Pqv00ifyA7-HeTRM
Follow My TikTok Channel For More Videos
👉👉https://www.tiktok.com/@mr.kpbro1?is_from_webapp=1&sender_device=pc
Like My Facebook Page











