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
// This is an example of how to use the new input system in a way that I think is actually | |
// usable for a production game, and not just rapid prototyping. This is much more stable, | |
// and because it uses the C# class version of the new Input System it will fail to compile | |
// if something changes in the input asset, which is a VERY GOOD THING. | |
using UnityEngine; | |
public class CameraInput | |
{ | |
public float Pitch = 0f; |
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.Generic; | |
using UnityEngine; | |
using UnityEngine.UI; | |
// Text2 extends the Text component in Unity UI. | |
// It makes hyphens and soft hyphens work. | |
// Inserting soft hyphens in text can be tricky and confusing, given they are invisible, | |
// so you can instead also insert Hyphenation Point characters, which will be replaced by soft hyphens: | |
// https://www.compart.com/en/unicode/U+2027 | |
public class Text2 : Text { |
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
/* | |
Cubemap shader with adjustable vertical Scale/Offset and HSV color controls. | |
Creation goal was to enable user to create several casually-looking skyboxes in different colors from single image, drawn in 2d editing software. | |
Features: | |
- Doesn't requires 6-sides cubemap, or spherical projection: texture can be easily drawn in any 2d image editing software; | |
- "V Offset" option allows to move horizon line up and down with ease; | |
- "V Scale" allows to stretch texture; | |
- Rotation feature sets horizontal offset (as in original shader). | |
- HSV controls allows to change 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
public class PixelPerfectTrail : MonoBehaviour | |
{ | |
[SerializeField] private TrailRenderer trail = null; | |
[Tooltip("How small the trail width is allowed to get in pixels.")] | |
public float MinimumPixelSize = 1.5f; | |
private float startSize = 1f; | |
private void Awake() |
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.Generic; | |
using UnityEngine; | |
using UnityEditor; | |
using UnityEditorInternal; | |
using System.IO; | |
public class Tex2DArrayCreator : EditorWindow { | |
private string fileName; | |
private List<Texture2D> textures = new List<Texture2D>(); |
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 System.Linq; | |
using UnityEditor; | |
using UnityEngine; | |
using Object = UnityEngine.Object; | |
public class MaterialGradientDrawer : MaterialPropertyDrawer { | |
private int resolution; |
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; | |
// Based on the Unity built-in image source (Unity Reference-Only License, https://unity3d.com/legal/licenses/Unity_Reference_Only_License) | |
// Modified to add full-mesh UVs by Brian MacIntosh | |
namespace UI | |
{ | |
/// <summary> | |
/// Image override that fills the second UV channel with uniform UVs over the entire image. |
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
Shader "WorldNormalFromDepthTexture" | |
{ | |
Properties { | |
[KeywordEnum(3 Tap, 4 Tap, Improved, Accurate)] _ReconstructionMethod ("Normal Reconstruction Method", Float) = 0 | |
} | |
SubShader | |
{ | |
Tags { "RenderType"="Transparent" "Queue"="Transparent" } | |
LOD 100 |
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
#pragma use_dxc //enable SM 6.0 features, in Unity this is only supported on version 2020.2.0a8 or later with D3D12 enabled | |
#pragma kernel CountTotalsInBlock | |
#pragma kernel BlockCountPostfixSum | |
#pragma kernel CalculateOffsetsForEachKey | |
#pragma kernel FinalSort | |
uint _FirstBitToSort; | |
int _NumElements; | |
int _NumBlocks; | |
bool _ShouldSortPayload; |
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
#include <cstdio> | |
#include <cmath> | |
struct float2 | |
{ | |
float x = 0.0f; | |
float y = 0.0f; | |
float2() {} | |
float2( float _x, float _y ) { x = _x; y = _y; } | |
}; |