Skip to content

Instantly share code, notes, and snippets.

View nkjzm's full-sized avatar
🐧
Working

Nakaji Kohki nkjzm

🐧
Working
View GitHub Profile
@nkjzm
nkjzm / NoRenderImage.cs
Last active February 6, 2020 16:16
描画負荷がかからない透明なuGUI Image
using UnityEditor;
namespace UnityEngine.UI
{
/// <summary>
/// 描画しない透明Imageコンポーネント
/// </summary>
[AddComponentMenu("UI/NonRenderImage", 14)]
public class NoRenderImage : Graphic
{
@nkjzm
nkjzm / PopButton.cs
Created January 15, 2020 22:49
DOTweenでポップにアニメーションするボタン
using UnityEngine.UI;
using DG.Tweening;
using UnityEngine;
namespace nkjzm
{
/// <summary>
/// ポップに押されるボタン
/// </summary>
public class PopButton : Button
@nkjzm
nkjzm / UniqueItemPicker.cs
Created November 19, 2019 09:33
【C#】リスト中から重複せずに要素を取り出すクラス
using System.Collections.Generic;
/// <summary>
/// リスト中から重複せずに要素を取り出すクラス
/// </summary>
public class UniqueItemPicker<T>
{
T[] AllItems;
/// <summary>
/// コンストラクタ
@nkjzm
nkjzm / ClickTest.cs
Created October 30, 2019 15:50
【Unity】クリック座標を指定してButton/ToggleのOnPointerClick()を発火させる【TestRunner】
using UnityEngine.TestTools;
using NUnit.Framework;
using System.Collections;
using UnityEngine.EventSystems;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.Linq;
using UnityEngine.SceneManagement;
@nkjzm
nkjzm / SaveStateExtensions.cs
Last active September 25, 2019 09:15
SliderやToggleの状態を簡易的に保存する拡張メソッド
using UnityEngine;
using UnityEngine.UI;
public static class SaveStateExtensions
{
public static void SaveState(this Toggle toggle, string key)
{
key = $"{new System.Diagnostics.StackFrame(1).GetMethod().ReflectedType}+{key}";
Debug.Log(key);
toggle.isOn = PlayerPrefs.GetInt(key, 0) == 1;
@nkjzm
nkjzm / EditorCamera.cs
Created September 9, 2019 15:18
Editor上でCameraをキーボード操作するためのコンポーネント
using UnityEngine;
/// <summary>
/// Editor上でCameraをキーボード操作するためのコンポーネント
/// </summary>
public class EditorCamera : MonoBehaviour
{
const float Angle = 30f;
const float Speed = 0.25f;
@nkjzm
nkjzm / ReplaceEventSystems.cs
Last active November 4, 2019 18:29
VRアプリ向けになっているEventSystemをEditor上からも操作できる形に組み替えるデバッグ用スクリプト
using System.Linq;
using System.Threading.Tasks;
using UnityEditor;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
/// <summary>
/// エディタ上でのアプリ起動時に自動実行されるデバッグ用スクリプト
@nkjzm
nkjzm / DebugMover.cs
Created June 17, 2019 10:53
Oculus Questで空間を自由に移動するデバッグ用スクリプト
using UnityEngine;
public class DebugMover : MonoBehaviour
{
[SerializeField]
Transform Head = null;
const float Angle = 30f;
const float DashSpeed = 5f;
const float SlowSpeed = 0.2f;
@nkjzm
nkjzm / ExclusiveInput.cs
Last active December 16, 2019 17:06
InputFieldの入力中に判定しない拡張Inputクラス(CC0)
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace UnityEngine
{
public class ExclusiveInput
{
public static bool IsFocusedOnInputField
{
get
@nkjzm
nkjzm / VRoidAccountSupporter.cs
Created January 29, 2019 11:40
VRoid SDKでアカウント周りのデバッグを支援するスクリプト。Editorフォルダ以下に入れると動作。CC0
using System.IO;
using UnityEditor;
using UnityEngine;
public class VRoidAccountSupporter
{
[MenuItem("Tools/VRoid/ResetAccount")]
static void ResetAccount()
{
File.Delete(Path.Combine(Application.persistentDataPath, "production_account"));