Unity's SerializedProperty not support custom type value setting. This extension use Reflection to get target instance of SerializedProperty in Custom Editor, made value setting of general type is posible.
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.Collections; | |
using System.Collections.Generic; | |
using System.Reflection; | |
using System.Text.RegularExpressions; | |
using UnityEditor; | |
using UnityEngine; | |
using UnityEngine.Assertions; | |
public static class SerializedPropertyExtensions |
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
#include "AutoLight.cginc" | |
#if defined(POINT) | |
// 1/range*range for Unity's PointLight | |
float UnityPointLightRangeInvSqr() | |
{ | |
float3 unitLS = float3(unity_WorldToLight._m00, unity_WorldToLight._m01, unity_WorldToLight._m02); | |
return dot(unitLS, unitLS); | |
} | |
// https://forum.unity.com/threads/light-dist ance-in-shader.509306/#post-3326818 |
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.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using UnityEditor; | |
using UnityEngine; | |
public class ShaderPropertiesGenerator : EditorWindow | |
{ |
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
Shader "Custom/hex tiling surface" | |
{ | |
Properties | |
{ | |
_Color ("Color", Color) = (1,1,1,1) | |
_MainTex ("Albedo (RGB)", 2D) = "white" {} | |
_Glossiness ("Smoothness", Range(0,1)) = 0.5 | |
_Metallic ("Metallic", Range(0,1)) = 0.0 | |
_RotStrength ("Rot Strength", FLOAT) = 0 | |
_FalloffContrast ("Falloff Contrast", FLOAT) = 0.6 |
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
Shader "Unlit/EmissonTestShader" | |
{ | |
Properties | |
{ | |
[HDR] | |
_EmissionColor("Emission Color",Color) = (0,0,0,0) | |
} | |
SubShader | |
{ | |
Tags { "RenderType"="Opaque" } |
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 UnityEngine; | |
using UnityEditor; | |
using System; | |
namespace GatoMaterialPropertyDrawer | |
{ | |
internal class LineDecorator : MaterialPropertyDrawer | |
{ | |
private float spaceSize; |
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
//関数内で大量に変数を定義するとGPU時間がめちゃ遅くなるのでスコープを使って書き直している部分があるので可読性が少し落ちている。ので注意。 | |
///ret : 0.0 - <1.0 | |
float rand(float n) | |
{ | |
return frac(sin(n) * 63452.5453123); | |
} | |
///ret : 0.0 - <1.0 | |
float rand(float2 co) | |
{ |
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
// DONT PUT IN EDITOR FOLDER | |
using System; | |
using UnityEngine; | |
/// <summary> | |
/// Attribute used to show or hide the Field depending on certain conditions | |
/// </summary> | |
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] | |
public class ShowWhenAttribute : PropertyAttribute { |
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.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEditor.Experimental.AssetImporters; | |
using System.IO; | |
using UnityEditor; | |
using UnityEngine.Assertions; | |
using System.Linq; | |
[ScriptedImporter(1, "cube")] |
NewerOlder