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
// Converted to C#, originally from https://girlscancode.wordpress.com/2015/03/02/unity3d-flipping-a-texture/ | |
Texture2D FlipText(Texture2D original) | |
{ | |
// We create a new texture so we don't change the old one! | |
Texture2D flip = new Texture2D(original.width,original.height); | |
// These for loops are for running through each individual pixel and then replacing them in the new texture. | |
for(int i=0; i < flip.width; i++) { | |
for(int j=0; j < flip.height; j++) { | |
flip.SetPixel(flip.width-i-1, j, original.GetPixel(i,j)); |
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 System; | |
using UnityEngine; | |
using WebSocketSharp; | |
using System.Collections; | |
public class SocketClient : MonoBehaviour { | |
// Public Variables | |
public string ConnectionString = "ws://echo.websocket.org"; | |
public string Message = "Hello World!"; |
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 System.Collections; | |
using System.Collections.Generic; | |
// using this for Text Demonstration | |
using UnityEngine.UI; | |
public class QT_Trigger : MonoBehaviour { | |
// We could probably gut the Done State but I use it for my purpose. | |
public enum QTState { Ready, Delay, Ongoing, Done }; | |
public QTState qtState = QTState.Ready; | |
// an enum for a possible response! |
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 System; | |
using UnityEngine; | |
public class Logger { | |
private static string CUSTOM_MESSAGE = "CUSTOM LOGS: "; | |
private static bool PrintLog() | |
{ | |
return true; | |
} |
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 System; | |
using UnityEngine; | |
[ExecuteInEditMode] | |
public class AlphaAnimator : MonoBehaviour | |
{ | |
[Range(0f, 1f), SerializeField] | |
private float m_alpha; | |
private Renderer m_renderer; | |
private MaterialPropertyBlock m_propBlock; |
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 System; | |
using UnityEngine; | |
public static class ArrayHelper | |
{ | |
public static T AddArrayElement<T>(ref T[] array) where T : new() | |
{ | |
return ArrayHelper.AddArrayElement<T>(ref array, (default(T) == null) ? Activator.CreateInstance<T>() : default(T)); | |
} | |
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 System; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.UI; | |
public class FPSCounter : MonoBehaviour | |
{ | |
[SerializeField] | |
public Text m_label; |
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 System; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public static class GameObjectExtension | |
{ | |
public static T GetComponentInParents<T>(this Component self) where T : Component | |
{ | |
return self.transform.GetComponentInParents<T>(); | |
} |
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 PowerUI.Css; | |
using UnityEngine; | |
namespace PowerUI{ | |
/// <summary> | |
/// This additive:// protocol enables a link to point to another scene. | |
/// E.g. href="additive://sceneName" will load the scene additive called 'sceneName' when clicked. | |
/// </summary> | |
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
String.format = function() { | |
// The string containing the format items (e.g. "{0}") | |
// will and always has to be the first argument. | |
var theString = arguments[0]; | |
// start with the second argument (i = 1) | |
for (var i = 1; i < arguments.length; i++) { | |
// "gm" = RegEx options for Global search (more than one instance) | |
// and for Multiline search | |
var regEx = new RegExp("\\{" + (i - 1) + "\\}", "gm"); |