https://github.com/gylansalih/vsc-unity-csharp-custom-snippets
A collection of useful C# snippets for Unity game development. These snippets are designed to speed up the process of writing commonly used methods and structures.
https://github.com/gylansalih/vsc-unity-csharp-custom-snippets
Last synced: 3 months ago
JSON representation
A collection of useful C# snippets for Unity game development. These snippets are designed to speed up the process of writing commonly used methods and structures.
- Host: GitHub
- URL: https://github.com/gylansalih/vsc-unity-csharp-custom-snippets
- Owner: GylanSalih
- License: mit
- Created: 2024-10-24T16:31:04.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-10-24T16:48:48.000Z (8 months ago)
- Last Synced: 2025-01-13T21:08:21.023Z (5 months ago)
- Size: 83 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# VSC Unity CSharp Custom Snippets
A collection of useful C# snippets for Unity game development. These snippets are optimized for use in Visual Studio Code and help you quickly create frequently used methods and structures.

## Contents
- **Unity Script Template**: A complete template for Unity scripts with essential namespaces and Start/Update methods.
- **Public Start Method**: Template for the `Start` method.
- **Public Update Method**: Template for the `Update` method.
- **Public FixedUpdate Method**: Template for the `FixedUpdate` method.
- **Public Coroutine Method**: Template for coroutines.
- **Public OnCollisionEnter2D Method**: Template for 2D collisions.
- **Public OnTriggerEnter2D Method**: Template for 2D triggers.## Usage
To use the snippets, follow these steps:
1. In Visual Studio Code, go to **Edit** -> **Preferences** -> **Configure User Snippets**.
2. Select **C#** from the list of languages.
3. Add the snippets to your `csharp.json` file.
4. You can then invoke the snippets by typing the corresponding trigger keywords in your C# code.## Example
### Unity Script Template
To create a new Unity script, type `unityscript` and press `Enter`. This will insert a pre-defined script with the basic structure.
- **Public Start Method**: Type `pubstart` to generate a public Start method with brackets.
- **Public Update Method**: Type `pubupdate` to generate a public Update method with brackets.
- **Public OnCollisionEnter2D Method**: Type `puboncollision2d` to generate a private OnCollisionEnter2D method with brackets.
- **Public OnTriggerEnter2D Method**: Type `pubontrigger2d` to generate a private OnTriggerEnter2D method with brackets.
- **Public Coroutine Method**: Type `pubcoroutine` to generate a public Coroutine method with brackets.
- **Public FixedUpdate Method**: Type `pubfixedupdate` to generate a public FixedUpdate method with brackets.## License
This project is licensed under the MIT License.