My Unity repo's git config as of today.
For more complex and complete alternatives, look at:
| Interaction in unity with Gradient via jobs + burst | |
| var gradient = new Gradient(); | |
| //Access Gradient.colorKeys and Gradient.alphaKey via NativeArray without a Garbage Collector: | |
| //Single threaded mode: | |
| var gradientPtr = gradient.DirectAccess(); | |
| using var colorKeys = gradientPtr->GetColorKeys(Allocator.Temp); | |
| using var alphaKeys = gradientPtr->GetAlphaKeys(Allocator.Temp); |
| public static class TweenExtensions | |
| { | |
| public static Task AsTask(this Tween tween, CancellationToken cancellationToken) | |
| { | |
| var taskCompletionSource = new TaskCompletionSource<bool>(); | |
| tween.OnComplete(() => { taskCompletionSource.TrySetResult(true); }); | |
| tween.OnKill(() => { taskCompletionSource.TrySetCanceled(); }); | |
| if (cancellationToken != CancellationToken.None) |
| ## Unity ## | |
| *.cs diff=csharp text | |
| *.cginc text | |
| *.shader text | |
| *.mat merge=unityyamlmerge eol=lf | |
| *.anim merge=unityyamlmerge eol=lf | |
| *.unity merge=unityyamlmerge eol=lf | |
| *.prefab merge=unityyamlmerge eol=lf |
| using UnityEngine; | |
| /// <summary> | |
| /// Keeps constant camera width instead of height, works for both Orthographic & Perspective cameras | |
| /// Made for tutorial https://youtu.be/0cmxFjP375Y | |
| /// </summary> | |
| public class CameraConstantWidth : MonoBehaviour | |
| { | |
| public Vector2 DefaultResolution = new Vector2(720, 1280); | |
| [Range(0f, 1f)] public float WidthOrHeight = 0; |
My Unity repo's git config as of today.
For more complex and complete alternatives, look at:
| using UnityEngine; | |
| namespace DitzeGames.Effects | |
| { | |
| /// <summary> | |
| /// Camera Effects | |
| /// </summary> | |
| public class CameraEffects : MonoBehaviour | |
| { |
| # Created by https://www.gitignore.io/api/unity | |
| # Edit at https://www.gitignore.io/?templates=unity | |
| # Jetbrain Rider Cache | |
| .idea/ | |
| Assets/Plugins/Editor/JetBrains* | |
| # Visual Studio Code | |
| .vscode/ |
I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).
Use ssh keys and define host aliases in ssh config file (each alias for an account).
| /* | |
| FastList<T> is a System.Collections.Generic.List<T> modification such, that allows to not produce garbage when using foreach. | |
| Useful for old versions of c# runtime (like Mono 2.x), i.e. for Unity. | |
| It implements own instance-type enumerator and caches only one instance of this enumerator inside. | |
| Instance-type enumerator allows to avoid boxing that occurs when foreach converts IEnumerator to IDisposable and calls Dispose(). | |
| (Default List<T> enumerator is value-type (struct), so when foreach converts to IDisposable, boxing occurs and 20 bytes of garbage will be collected.) | |
| Warnings: |