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; |
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
/* | |
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
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
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
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
{ | |
"data": 0 | |
} |
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
[ | |
{ | |
"data_0": "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Is ita vivebat, ut nulla tam exquisita posset inveniri voluptas, qua non abundaret. Tu autem negas fortem esse quemquam posse, qui dolorem malum putet. Universa enim illorum ratione cum tota vestra confligendum puto. Si est nihil in eo, quod perficiendum est, praeter motum ingenii quendam, id est rationem, necesse est huic ultimum esse virtute agere; Duo Reges: constructio interrete. Velut ego nunc moveor. Fatebuntur Stoici haec omnia dicta esse praeclare, neque eam causam Zenoni desciscendi fuisse. Primum quid tu dicis breve? Maximas vero virtutes iacere omnis necesse est voluptate dominante. Aut haec tibi, Torquate, sunt vituperanda aut patrocinium voluptatis repudiandum. Ita finis bonorum existit secundum naturam vivere sic affectum, ut optime is affici possit ad naturamque accommodatissime. A quibus propter discendi cupiditatem videmus ultimas terras esse peragratas. Nos autem non solum beatae vitae istam esse oblectationem videm |
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 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): |