Skip to content

Instantly share code, notes, and snippets.

View wotakuro's full-sized avatar

Yusuke Kurokawa wotakuro

View GitHub Profile
#if DEBUG
using UnityEngine;
using Unity.Profiling.LowLevel.Unsafe;
using System;
using Unity.Profiling.LowLevel;
using Unity.Profiling;
using Unity.Collections.LowLevel.Unsafe;
using System.Runtime.CompilerServices;
using System.Diagnostics.Contracts;
using System.Diagnostics;
@wotakuro
wotakuro / SerializedObjectDebugWindow.cs
Created February 7, 2024 08:29
SerializedObjectDebugWindow
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEngine.UIElements;
using UnityEditor.UIElements;
using System.IO;
using System.Text;
public class SerializedObjectDebugWindow : EditorWindow
@wotakuro
wotakuro / ReserchForShaderStrip.cs
Last active October 6, 2023 08:21
[Unity]ShaderVariantのStripを調べる君
/**
* ビルドをしたりすると描画がおかしくなってしまうと言う事が起きているので、
* ビルド時のShaderVariant周りをログに書き出すデバッグ機能を作りました
*
* これは、IPreprocessShaders(Stripping scriptable shader variants)でログ書き出しのみを行う事で実現しています。
* https://blog.unity.com/engine-platform/stripping-scriptable-shader-variants
*
* デフォルト挙動では、プロジェクト直下に「ShaderBuildLog」というフォルダを作成し、
* ビルドのタイムスタンプごとにフォルダを作成するようにしています
*
@wotakuro
wotakuro / StreamingAssetsDynamicTest.cs
Created January 16, 2023 07:57
StreamingAssetsをプラットフォームごとに分ける
using UnityEditor.Build;
using UnityEditor;
public class StreamingAssetsDynamicTest : BuildPlayerProcessor
{
public override void PrepareForBuild(BuildPlayerContext buildPlayerContext)
{
var buildTarget = buildPlayerContext.BuildPlayerOptions.target;
@wotakuro
wotakuro / GetShaderVariantsExtention.cs
Last active January 5, 2023 15:10
GetShaderVariantsExtention
/**
MIT License
Copyright (c) 2022 Unity Technologies Japan
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 / WebGLUtility.cs
Last active January 4, 2023 08:40
Unity WebGLUtility
using UnityEngine;
using UnityEditor;
using System;
using System.Reflection;
namespace UTJ
{
public class WebGLUtility
{
private static Type httpServerEditorWrapperType;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Profiling;
using UnityEngine.UI;
using System.Text;
using Unity.Profiling.LowLevel.Unsafe;
public class ReleaseBuildRecordCheck : MonoBehaviour
{
@wotakuro
wotakuro / ObjectRegisterWatchExample.cs
Created December 21, 2022 10:34
Unity ObjectRegister.WatchSample( Unity 2022 +)
using UnityEditorInternal;
using UnityEditor.Profiling;
using UnityEditor;
public class ObjectRegisterWatchExample
{
[MenuItem("Tools/ExecuteTest")]
public static void Execute()
{
int objRegistmaker = FrameDataView.invalidMarkerId;
@wotakuro
wotakuro / AlwaysCreateGPUProgramAtEditor.cs
Last active January 21, 2022 07:39
Shader.CreateGPUProgramをUnityEditorで常に呼び出されるようにしたい!!
// UnityEditor上ではShaderオブジェクトが残ったままになります
// 一度 Shader.CreateGPUProgramが走ってしまうと、その後に再生してもShader.CreateGPUProgramは残りません。
// なので、Editor上で余計なCreateGPUProgramを発見
//
// 使い方、このソースコードをプロジェクト内に入れてください。
// そして「Tools/UTJ/AlwaysCraateGPUProgram/Enable」をチェックしてください
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
@wotakuro
wotakuro / RenderingGpuWatcher.cs
Last active February 19, 2024 01:07
Unity 2021.2+URPで画面にGPU処理時間を出します
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
using UnityEngine.UI;
#if DEBUG