This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# convert gifs to webp files with quality 70 and 1 frame skip. | |
# ~85% size reduction | |
import os | |
from PIL import Image, ImageSequence | |
def get_files(directory='.', extensions=None): | |
found = [] | |
for root, dirs, files in os.walk(directory): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Extension method to allow UnityWebRequest to be used with async/await. | |
/// </summary> | |
/// <param name="request">The UnityWebRequest to await.</param> | |
public async static Task SendRequestAsync(this UnityWebRequest request) | |
{ | |
UnityWebRequestAsyncOperation op = request.SendWebRequest(); | |
while(!op.isDone) await Task.Yield(); | |
} |
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data": 0 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void Vertical(Action content, bool isBox = false) | |
{ | |
EditorGUILayout.BeginVertical(isBox ? "Box" : GUIStyle.none); | |
content?.Invoke(); | |
EditorGUILayout.EndVertical(); | |
} | |
private void Horizontal(Action content, bool isBox = false) | |
{ | |
EditorGUILayout.BeginHorizontal(isBox ? "Box" : GUIStyle.none); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
RandomItem<string> operation = new RandomItem<string>(); | |
operation.Add("A", 0.4d); | |
operation.Add("B", 0.5d); | |
operation.Add("D"); | |
Console.WriteLine(operation.Random().item); | |
Console.WriteLine(operation.Random().item); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int start = 0; //inclusive | |
int end = 20; //exclusive | |
Random random = new Random(); | |
int[] res = Enumerable.Range(start, end).OrderBy( i => random.Next()).ToArray<int>(); | |
Console.WriteLine(res); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
To be able to use these you need to create an object instance of Player prefs then call the get/set extention methods. | |
*/ | |
using UnityEngine; | |
public static class ExtensionMethods | |
{ | |
public static void SetBool(this PlayerPrefs pref, string key, bool value) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Recurse recurse(Recurse r) { | |
return Recurse.recurse(r); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEngine.UI; | |
public class TextColor : MonoBehaviour { | |
public Color from = new Color(255, 255, 0); | |
public Color to = new Color(0, 255, 0); | |
public float switchDuration = 1; | |
private Color change; | |
private Text myText; |