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 System.Collections; | |
| using ZXing; | |
| public class ReadBarcodeFromFile : MonoBehaviour | |
| { | |
| public Texture2D inputTexture; // Note: [x] Read/Write must be enabled from texture import settings | |
| 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
| // http://stackoverflow.com/a/23214321/5452781 | |
| // http://answers.unity.com/comments/271621/view.html | |
| int wrap(int k, int n) { return ((k %= n) < 0) ? k + n : k; } | |
| // example | |
| myval = wrap(myval-1,maxval); | |
| myval = wrap(myval+1,maxval); |
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
| Windows Registry Editor Version 5.00 | |
| [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ImmersiveShell] | |
| "UseWin32TrayClockExperience"=dword:00000001 | |
| ; reference: http://www.thewindowsclub.com/enable-old-windows-clock-calendar-windows-10 |
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 System.Collections; | |
| // attach this script to your player gameobject | |
| // player needs RigidBody2D and some 2D collider | |
| // your collectible objects need: 2D Collider with [x] Trigger and gameobject tag: "Item" | |
| public class CollectItems : MonoBehaviour | |
| { | |
| public float speed = 10; |
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
| var c = lerp(_Color1, _Color2, abs(fmod(_Time.w * _Speed, 2.0) - 1.0)); // ping pong |
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 System.Collections; | |
| public class PlayerHoverController : MonoBehaviour | |
| { | |
| public float forwardSpeed = 10; | |
| public float strafeSpeed = 10; | |
| public float runMultiplier = 2; | |
| public KeyCode runKey = KeyCode.LeftShift; | |
| public LayerMask groundLayer; |
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
| High precision: float | |
| Highest precision floating point value; generally 32 bits (just like float from regular programming languages). | |
| Full float precision is generally used for world space positions, texture coordinates, or scalar computations involving complex functions such as trigonometry or power/exponentiation. | |
| Medium precision: half | |
| Medium precision floating point value; generally 16 bits (range of –60000 to +60000, with about 3 decimal digits of precision). | |
| Half precision is useful for short vectors, directions, object space positions, high dynamic range colors. |
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
| // removed ColorTint, Added clip() based on alpha | |
| Shader "Sprites/Clip" | |
| { | |
| Properties | |
| { | |
| [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} | |
| [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0 | |
| _Cutoff ("AlphaCutoff", Range(0,1)) = 1 | |
| } |
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
| // removed ColorTint, Transparency, Added clip() based on alpha | |
| Shader "Sprites/Clip-NoTransparency" | |
| { | |
| Properties | |
| { | |
| [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} | |
| [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0 | |
| _Cutoff ("AlphaCutoff", Range(0,1)) = 1 | |
| } |
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
| "The common wisdom of "don't use conditionals in shaders" is one of my biggest frustrations with how shaders are taught. | |
| step(y, x) _is_ a conditional! It compiles to identical code as: | |
| float val = (x >= y ? 1.0 : 0.0) | |
| or | |
| float val = 0.0; | |
| if (x >= y) val = 1.0;" | |
| https://twitter.com/bgolus/status/1235254923819802626 | |
| // Performing shader divisions without diving *rcp = approximation of 1/x | |
| float myDividedVal = myValToDivide * rcp(myDivider); |