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; | |
| using TMPro; | |
| using UnityEngine; | |
| public class Typewriter : MonoBehaviour | |
| { | |
| public TextMeshProUGUI Writer; | |
| public void TypingText(string text, float speed = 50, Action onComplete = null) |
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
| require 'webrick' | |
| require 'fileutils' | |
| if ARGV.length != 0 | |
| root = ARGV.first.gsub('\\', '/') | |
| else | |
| root = '.' | |
| end | |
| BACKUP_DIR = 'bak' |
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; | |
| public class CameraAdapt : MonoBehaviour | |
| { | |
| private readonly float AdaptScreenWidth = 720; | |
| private readonly float AdaptScreenHeight = 1280; | |
| private float _adaptSizeW; | |
| private Camera _mainCam; | |
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
| // http://wiki.unity3d.com/index.php/Singleton | |
| // http://www.unitygeek.com/unity_c_singleton/ | |
| using UnityEngine; | |
| public class SingletonUnity<T> : MonoBehaviour | |
| where T : SingletonUnity<T> | |
| { | |
| private static T instance; |
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
| // https://docs.unity3d.com/Manual/SL-VertexFragmentShaderExamples.html | |
| Shader "Custom/SingleColor" | |
| { | |
| Properties | |
| { | |
| _Color ("Main Color", Color) = (1,1,1,1) | |
| } | |
| SubShader | |
| { |
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 static Vector3 GetBezierCurvePos(Vector3 startPos, Vector3 middlePos, Vector3 endPos, float t) | |
| { | |
| Vector3 segPos1 = Vector3.Lerp(startPos, middlePos, t); | |
| Vector3 segPos2 = Vector3.Lerp(middlePos, endPos, t); | |
| Vector3 segPos3 = Vector3.Lerp(segPos1, segPos2, t); | |
| return segPos3; | |
| } |
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 SetCustomPivot : MonoBehaviour | |
| { | |
| private void Start() | |
| { | |
| var image = GetComponent<Image>(); | |
| var sprite = image.sprite; | |
| image.GetComponent<RectTransform>().pivot = new Vector2( |
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; | |
| public class MeshLightMapSetting : MonoBehaviour | |
| { | |
| public int lightmapIndex; | |
| public Vector4 lightmapScaleOffset; | |
| public void SaveSettings() | |
| { | |
| Renderer renderer = GetComponent<Renderer>(); |
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 class CameraAdapt : MonoBehaviour | |
| { | |
| private float _adaptFieldWidth; | |
| private float _adaptScreenWidth = 720; | |
| private float _adaptScreenHeight = 1280; | |
| private Camera mainCam; | |
| #region unity event function | |
| private void Start() | |
| { |
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 static class ExtensionTransform | |
| { | |
| private static string lastFirst = "└─"; | |
| private static string lastNotFirst = " "; | |
| private static string notLastFirst = "├─"; | |
| private static string notLastNotFirst = "│ "; | |
| public static void ShowHeirarchy(this Transform trans) | |
| { | |
| _ShowHeirarchy(trans, ""); |
NewerOlder