Skip to content

Instantly share code, notes, and snippets.

View wotakuro's full-sized avatar

Yusuke Kurokawa wotakuro

View GitHub Profile
@wotakuro
wotakuro / ProfilingUtil.cs
Last active March 24, 2017 05:50
Make inserting Profiler call to your code more easily.
using System.Collections;
#if UNITY_5_5_OR_NEWER
using UnityEngine.Profiling;
#else
using UnityEngine;
#endif
/** Make inserting Profiler call to your code more easily.
*
@wotakuro
wotakuro / Appear.shader
Created May 22, 2018 02:44
適当に作った 出現エフェクト用 Shader
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "App/Appear"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Height("_Height",Float) = 1.0
_AppearTime ("_AppearTime", Range(0.0,1.0)) = 1.0 // sliders
_AppearColor ("_AppearColor", Color) = (.34, .85, .92, 1) // color
@wotakuro
wotakuro / CustomAutoLight.cginc
Created May 30, 2018 15:31
[Unity] Creating my own shader with shadows for LightWeightRenderPipeline(LWRP)
sampler2D _ScreenSpaceShadowMap;
#define SHADOW_COORDS(idx1) float4 shadowCoord : TEXCOORD##idx1;
#define TRANSFER_SHADOW(a) a.shadowCoord = CustomCalculateScreenPos(a.pos)
#define SHADOW_ATTENUATION(i) tex2D(_ScreenSpaceShadowMap, i.shadowCoord.xy/i.shadowCoord.w).x
inline float4 CustomCalculateScreenPos(float4 pos) {
float4 o = pos * 0.5f;
o.xy = float2(o.x, o.y*_ProjectionParams.x) + o.w;
o.zw = pos.zw;
@wotakuro
wotakuro / VersionControlCLITips.cs
Created March 17, 2020 16:42
VersionControl tips
using UnityEngine;
using UnityEditor;
public class VersionControlCLITips
{
public class GitInfo
{
public string branch;
public long lastupdate;
public string hash;
#include "DigiKeyboard.h"
const int LED_PIN = 0;
const int LED_PIN2 = 1;
const int BTN_PIN = 2;
void setup() {
// don't need to set anything up to use DigiKeyboard
pinMode(LED_PIN,OUTPUT);
pinMode(LED_PIN2,OUTPUT);
pinMode(BTN_PIN,INPUT);
@wotakuro
wotakuro / StrippingByVariantCollection.cs
Last active February 7, 2022 12:43
プロジェクト内にあるShaderVariantCollectionにないKeywordはビルドに含まないようにするEditor拡張です
/*
MIT License
Copyright (c) 2020 Yusuke Kurokawa
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@wotakuro
wotakuro / PackageManagerAutoInstaller.cs
Last active May 29, 2020 15:42
PackageManagerを自動で入れる君
/**
MIT License
Copyright (c) 2019 Yusuke Kurokawa
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@wotakuro
wotakuro / UnityEditor拡張便利群.txt
Last active September 27, 2022 08:09
UnityEditor拡張便利群
1.プロジェクトのアセットをザクっと見渡すツールです
https://github.com/wotakuro/AssetsReporter
2.300フレーム毎にProfilerログを保存することで300フレーム上限問題を回避します。
https://github.com/wotakuro/UnityProfilerIntervalSave
3.Profilerのログを分割する事で、300フレーム上限問題を回避します
https://github.com/wotakuro/ProfilerBinarylogSplit
4.ScreenShotをProfilerのログに埋め込みします
using UnityEngine;
public class CameraViewer : MonoBehaviour
{
// Update is called once per frame
void Update()
{
if (Application.isMobilePlatform)
{
@wotakuro
wotakuro / ShaderParseWatcher.cs
Created November 24, 2020 05:28
ProfilerのShader.Parseをウォッチして、ファイルに書き込む君
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Profiling;
using System.IO;
using System.Text;
public class ShaderParseWatcher : MonoBehaviour
{