This file contains 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
/** | |
MIT License | |
Copyright (c) 2023 Bayat Games | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
This file contains 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 System.Collections.Generic; | |
/// <summary> | |
/// A simple static class to get and set globally accessible variables through a key-value approach. | |
/// </summary> | |
/// <remarks> | |
/// <para>Uses a key-value approach (dictionary) for storing and modifying variables.</para> | |
/// <para>It also uses a lock to ensure consistency between the threads.</para> | |
/// </remarks> | |
public static class GlobalVariables |
This file contains 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
Debug.Log("<color=#" + ColorUtility.ToHtmlStringRGB(col) + ">████████████</color> = " + col); |
This file contains 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 System; | |
using System.Security.Cryptography; | |
// ReSharper disable SuggestVarOrType_SimpleTypes - BCL rules | |
namespace Crypto | |
{ | |
/// <summary> | |
/// Simple implementation of ECIES (Elliptic Curve Integrated Encryption Scheme) based on http://www.secg.org/sec1-v2.pdf, section 5.1 | |
/// Things not implemented: | |
/// - Encoding parameters using compressed points; only uncompressed points are used |
This file contains 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 UnityEditor; | |
public static class ExtraEditorGUILayout | |
{ | |
public static void ReadonlyTextArea(string text, params GUILayoutOption[] options) | |
{ | |
EditorGUILayout.SelectableLabel(text, EditorStyles.textArea, options); | |
} |
This file contains 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
// example script for restarting Coroutine after gameobject was disabled (and continue from previous timer value) | |
using System.Collections; | |
using UnityEngine; | |
using UnityEngine.UI; | |
public class ContinueCoroutine : MonoBehaviour | |
{ | |
public float duration = 5f; |
This file contains 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
/* | |
* Created by Galvanic Games (http://galvanicgames.com) | |
* | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2019 | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights |
This file contains 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
Texture2D[] layers; | |
Texture2D compiledTexture = new Texture2D(layers[0].width, layers[0].height); | |
foreach(Texture2D layer in layers){ | |
Color[] baseColors = compiledTexture.GetPixels(); | |
Color[] layerColors = layer.GetPixels(); | |
for(int p = 0; p < baseColors.Length; p++){ |
This file contains 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 System.Collections.Generic; | |
using System.IO; | |
using UnityEditor; | |
using UnityEditorInternal; | |
using UnityEngine; | |
// This is only useful for spritesheets that need to be automatically sliced (Sprite Editor > Slice > Automatic) | |
public class AutoSpriteSlicer | |
{ | |
[MenuItem("Tools/Slice Spritesheets %&s")] |
This file contains 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 System; | |
using UnityEngine; | |
[Serializable] | |
public struct MinMax | |
{ | |
[SerializeField] | |
private float min; | |
[SerializeField] |
NewerOlder