Skip to content

Instantly share code, notes, and snippets.

View kaiware007's full-sized avatar

kaiware007 kaiware007

View GitHub Profile
@kaiware007
kaiware007 / CubeMeshMaker.cs
Last active November 30, 2019 06:09
立方体を等分割したメッシュを作成するEditor拡張。GPUパーティクル芸用なのでUV座標は入ってないし通常のシェーダではまともに表示されない可能性大。Editorフォルダに入れてメニューからCustom/Cube Mesh Makerを選択して使う。
using UnityEngine;
using UnityEditor;
public class CubeMeshMakerWizard : ScriptableWizard
{
public string filename = "mesh";
public int xnum = 10;
public int ynum = 10;
public int znum = 10;
@kaiware007
kaiware007 / Texture2DArrayCreator.cs
Created September 24, 2019 02:09
Create Texture2DArray
public class Texture2DArrayCreator {
[SerializeField]
Texture2D[] textures;
public Texture2DArray texArray = null;
void CreateTexture2DArray()
{
int width = textures[0].width;
int height = textures[0].height;
@kaiware007
kaiware007 / CommandLineArgsManager.cs
Created January 23, 2019 10:45
Command line args manager for Unity
using System.Collections.Generic;
using UnityEngine;
[DefaultExecutionOrder(-10000)]
public class CommandLineArgsManager : SingletonMonoBehaviour<CommandLineArgsManager> {
List<string> args = new List<string>();
private void Initialize()
{
using UnityEngine;
public class SimpleParticlePlayer : MonoBehaviour {
/// <summary>
/// パーティクルシステムへの参照
/// </summary>
[SerializeField]
ParticleSystem particleSystem;
@kaiware007
kaiware007 / AutoRotate.cs
Created September 16, 2018 20:03
Auto rotate Script for Unity
using UnityEngine;
public class AutoRotate : MonoBehaviour {
public Vector3 axis = Vector3.up;
public float rotSpeed = 100;
void Update () {
transform.rotation *= Quaternion.AngleAxis(rotSpeed * Time.deltaTime, axis);
}
}
@kaiware007
kaiware007 / ScreenAdjustTransform.cs
Last active September 16, 2018 14:41
Orthographicカメラの大きさいっぱいにTransformを拡縮するスクリプト(Unity3D)
using UnityEngine;
public class ScreenAdjustTransform : MonoBehaviour {
public Camera targetCamera = null;
void AdjustScreen()
{
float height = targetCamera.orthographicSize * 2;
float width = height * targetCamera.aspect;
@kaiware007
kaiware007 / unicode2utf16.sh
Created July 24, 2018 18:22
unicode番号のbmpファイルの名前をutf-16のファイル名に変更するシェルスクリプト
#!/bin/bash
function convUTF16() {
n=`echo $((0x$1-0x10000))`
nn=$n
if [ $n -lt 0 ]; then
nn=`echo $((0x$1))`
fi
echo $nn
}
@kaiware007
kaiware007 / startup.cmd
Created June 15, 2018 08:28
Unity Startup Batch 自動再起動、ログファイルを日時でリネーム、10日以上前のログファイル削除機能付き
REM "フォルダ名=appname"
for %%* in (.) do set appname=%%~nx*
if not exist LogBackup/ mkdir LogBackup
REM 10日以上前のログファイル削除
forfiles /P LogBackup /D -10 /M "output_log_*.txt" /c "cmd /c del @file"
:begin
@kaiware007
kaiware007 / AlwaysTopWindow.cs
Last active June 9, 2023 08:24
ウィンドウを常に最前面に出るフラグを立てる for Unity
using UnityEngine;
using System.Runtime.InteropServices;
using System;
using System.Threading;
public class AlwaysTopWindow : MonoBehaviour {
/// <summary>
/// 常に前面に出るか?
@kaiware007
kaiware007 / FlipRotation.shader
Created April 3, 2018 07:22
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