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 / EyeJitter.cs
Created December 6, 2018 17:58 — forked from GOROman/EyeJitter.cs
Unityで微細眼球運動っぽい何か
using UnityEngine;
using System.Collections;
public class EyeJitter : MonoBehaviour {
float timer = 0.0f;
Quaternion rot;
public float changeTime = 0.4f; // 変更する時間最小値
@nkjzm
nkjzm / RectTransformExtensions.cs
Last active April 7, 2022 12:17
座標を変えずにPivotとAnchorの値を変えるRectTransformの拡張メソッド
using UnityEngine;
public static class RectTransformExtensions
{
/// <summary>
/// 座標を保ったままPivotを変更する
/// </summary>
/// <param name="rectTransform">自身の参照</param>
/// <param name="targetPivot">変更先のPivot座標</param>
public static void SetPivotWithKeepingPosition(this RectTransform rectTransform, Vector2 targetPivot)
@nkjzm
nkjzm / CaptureScreenshotFromEditor.cs
Created November 17, 2018 16:48 — forked from dj-kusuha/CaptureScreenshotFromEditor.cs
Unityエディタ上からGameビューのスクリーンショットを撮るEditor拡張。
using UnityEditor;
using UnityEngine;
namespace djkusuha.Utility
{
/// <summary>
/// Unityエディタ上からGameビューのスクリーンショットを撮るEditor拡張
/// </summary>
public class CaptureScreenshotFromEditor : Editor
{
<a href="Astronaut.usdz" rel="ar"><img src="Astronaut.gif" /></a>
@nkjzm
nkjzm / FlipRotation.shader
Created October 25, 2018 04:28 — forked from kaiware007/FlipRotation.shader
UVを回転&上下左右反転できるシェーダーのサンプル UV top / bottom / left / right Flipping & 90 Degree Rotation Shader sample
Shader "Unlit/Flip Rotation"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
[KeywordEnum(ANGLE0, ANGLE90, ANGLE180, ANGLE270)] _ROTATEFLAG("Rotation", Float) = 0
[Toggle] _FLIP_X("Flip X", Float) = 0
[Toggle] _FLIP_Y("Flip Y", Float) = 0
@nkjzm
nkjzm / RestartOnStop.cs
Created September 11, 2018 06:33 — forked from sh-akira/RestartOnStop.cs
UnityエディタでStopしたときにエディタを再起動するエディタ拡張です
//
// Unity Restart Editor On Stop
// @sh_akira
// Put this file to Assets/Editor/
//
using UnityEngine;
using UnityEditor;
[InitializeOnLoad]
@nkjzm
nkjzm / PathReplacer.cs
Created August 28, 2018 09:11
System.IO.Path.DirectorySeparatorCharの値をリフレクションで書き換える方法
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Reflection;
[InitializeOnLoad]
public class PathReplacer
{
static PathReplacer()
{
@nkjzm
nkjzm / Test.cs
Created August 18, 2018 14:31
【Unity】コマンドライン引数で単一ビルドに複数ビルドの振る舞いをさせる ref: https://qiita.com/splas_boomerang/items/0bb9335111a596b6774f
public class Test : MonoBehaviour
{
void Start()
{
string[] args = System.Environment.GetCommandLineArgs();
for (int i = 0; i < args.Length; ++i)
{
switch (args[i])
{
case "-mode":
@nkjzm
nkjzm / LICENSE
Created August 16, 2018 07:34
This license applies to all public gists https://gist.github.com/nkjzm
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@nkjzm
nkjzm / (抜粋)OVRInput.cs
Last active December 20, 2018 12:50
OculusGoのコントローラーをUnity上でエミュレートする ref: https://qiita.com/nkjzm/items/83d3ab0862fbfef86b63
public static Vector2 Get(Axis2D virtualMask, Controller controllerMask = Controller.Active)
{
return GetResolvedAxis2D(virtualMask, RawAxis2D.None, controllerMask);
}