Skip to content

Instantly share code, notes, and snippets.

View sokuhatiku's full-sized avatar

Sokuhatiku sokuhatiku

View GitHub Profile
float3 RaycastSphere(float3 origin, float3 direction, out float hit)
{
float radius = _HoleRadius;
float3 holeOrigin = _HoleOffset;
float3 toCenter = holeOrigin - origin;
if (SqrLength(toCenter) <= pow(radius, 2))
{
hit = 1;
return origin;
using UnityEngine;
using UnityEditor;
public class AssetTypeCheckerWindow : EditorWindow
{
Object obj;
string msg;
[MenuItem("Window/AssetType Checker")]
static void Init()
#if UNITY_EDITOR
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
namespace Sokuhatiku.TunnelShader
{
public class TunnelMeshCompressor : EditorWindow
{
private const string Name = "Tunnel Mesh Complesser";
@sokuhatiku
sokuhatiku / HideFlags for Spreadsheet.md
Last active June 2, 2019 12:34
UnityEngine.HideFlags Checker
= TEXTJOIN(" | ", TRUE, IF($F2 = 0, "HideFlags.None", ""), IF(BITAND($F2, 1) = 1, "HideFlags.HideInHierarchy", ""), IF(BITAND($F2, 2) = 2, "HideFlags.HideInInspector", ""), IF(BITAND($F2, 4) = 4, "HideFlags.DontSaveInEditor", ""), IF(BITAND($F2, 8) = 8, "HideFlags.NotEditable", ""), IF(BITAND($F2, 16) = 16, "HideFlags.DontSaveInBuild", ""), IF(BITAND($F2, 32) = 32, "HideFlags.DontUnloadUnusedAsset", ""), IF(BITAND($F2, 52) = 52, "HideFlags.DontSave", ""), IF(BITAND($F2, 61) = 61, "HideFlags.HideAndDontSave", ""))
public static IEnumerable<Object> LoadAssetsFromPathWithSubAssets(this IEnumerable<string> paths)
{
foreach (var path in paths)
{
var assets = AssetDatabase.LoadAllAssetsAtPath(path);
if (assets == null || assets.Length == 0)
{
yield return AssetDatabase.LoadAssetAtPath<Object>(path);
yield break;
}
@sokuhatiku
sokuhatiku / Info.cs
Created April 30, 2019 08:28
VitDeck GUI flow
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace VitDeck.Main
{
public class Info
{
public static event Action<Info> OnInstantiated;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using UnityEditor;
using UnityEngine;
using UnityEngine.Networking;
public class PackageDownloadTest : EditorWindow
{
@sokuhatiku
sokuhatiku / config.yaml
Last active January 25, 2023 10:45
Verdaccio for Unitypackage
#
# This is the default config file. It allows all users to do anything,
# so don't use it on production systems.
#
# Look here for more config file examples:
# https://github.com/verdaccio/verdaccio/tree/master/conf
#
# path to a directory with all packages
storage: ./storage
@sokuhatiku
sokuhatiku / DrawScriptAndEditorField.cs
Created February 7, 2017 07:11
Draw "Script" field and "Editor" field.
EditorGUI.BeginDisabledGroup(true);
EditorGUILayout.ObjectField("Script", MonoScript.FromMonoBehaviour((MonoBehaviour)target), typeof(MonoScript), false);
EditorGUILayout.ObjectField("Editor", MonoScript.FromScriptableObject(this), typeof(MonoScript), false);
EditorGUI.EndDisabledGroup();
@sokuhatiku
sokuhatiku / AssetTypeCheckerWindow.cs
Last active February 8, 2017 04:34
Create AssetType Checker window
using UnityEngine;
using UnityEditor;
public class AssetTypeCheckerWindow : EditorWindow
{
Object obj;
string msg;
[MenuItem("Window/AssetType Checker")]
static void Init()