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.Linq; | |
using System.Diagnostics; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
using System.Collections.Generic; | |
namespace ConsoleApplication3 | |
{ | |
class Program |
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
#define UNITY_5_PLUS | |
#if UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 | |
#undef UNITY_5_PLUS | |
#endif | |
using UnityEngine; | |
using System.Reflection; | |
using UnityEditor; | |
namespace CodeStage.Maintainer.Tools |
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
/// <summary> | |
/// Vertically flips a render texture in-place. | |
/// </summary> | |
/// <param name="target">Render texture to flip.</param> | |
public static void VerticallyFlipRenderTexture(RenderTexture target) | |
{ | |
var temp = RenderTexture.GetTemporary(target.descriptor); | |
Graphics.Blit(target, temp, new Vector2(1, -1), new Vector2(0, 1)); | |
Graphics.Blit(temp, target); | |
RenderTexture.ReleaseTemporary(temp); |
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
public static class Extensions | |
{ | |
public static T GetOrAddComponent<T>(this GameObject gameObject) where T : Component | |
{ | |
if(gameObject.TryGetComponent<T>(out T t)) | |
{ | |
return t; | |
} | |
else | |
{ |