Skip to content

Instantly share code, notes, and snippets.

@watapj
watapj / ShaderAssetsAutoGenerator.cs
Created April 26, 2025 13:29
Shaderファイルを作成したときに、インクルード用HLSLファイルとマテリアルを一括生成するエディタ拡張
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Text.RegularExpressions;
using System.Collections.Generic;
namespace WataOfuton
{
/// <summary>
/// 1行目に “// MY_CUSTOM_TEMPLATE_MARKER” という文字列を含むシェーダーを検出したら、
@watapj
watapj / ImportFolderUnifier.cs
Created November 21, 2024 12:33
ImportFolderUnifier
using System.IO;
using UnityEditor;
using UnityEngine;
namespace WataOfuton.Tool
{
public class ImportFolderUnifier : AssetPostprocessor
{
// 機能概要
// アセットをインポートした際に、targetDirNames 内に同名フォルダが存在する場合、
@watapj
watapj / wataShaderInspector.cs
Last active October 19, 2024 11:59
自作 ShaderGUI. Attribute を検知して自動でまとめてくれる.
/* Reference
https://karanokan.info/2020/10/22/post-5625/
https://qiita.com/luckin/items/96f0ce9e1ac86f9b51fc
https://tips.hecomi.com/entry/2016/10/15/004144
https://qiita.com/Fuji0k0/items/4f4bfa552e5c7967ac60
https://qiita.com/skkn/items/76767ee7e1897e5ba8ec
https://light11.hatenadiary.com/entry/2018/10/17/222641
StandardShaderGUI.cs
@watapj
watapj / SymmetryBoneEditor.cs
Last active September 8, 2024 03:03
Humanoidリグを想定し、左右対称となるボーンを探して、ボーンのTransformの変更を反対側にも自動で反映させるエディタ拡張
/*
* This code was generated with the help of ChatGPT, an AI language model developed by OpenAI.
* Please save this script in a folder named "Editor".
*/
using System.Reflection;
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
using System.Linq;
@watapj
watapj / SetLightmapsMaterials.cs
Created July 3, 2021 09:13
テクスチャをひたすらマテリアルにアタッチするスクリプト
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
using System.IO;
using System;
using UnityEditor.Events;
using UnityEditor.Animations;
#endif
@watapj
watapj / GenerateCubemap.cs
Last active July 3, 2021 09:10
6SideなテクスチャからCubemapを作成するスクリプト
//https://docs.unity3d.com/ja/2018.4/Manual/class-Cubemap.html
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
using System.IO;
using System;
using UnityEditor.Events;