Skip to content

Instantly share code, notes, and snippets.

@knasa21
knasa21 / ScreenDoorTransparent.shader
Last active January 14, 2020 14:00
カメラに近づくとディザ抜きで透明になるシェーダー
Shader "Custom/ScreenDoorTransparent"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_BayerTex ("BayerTex", 2D) = "black" {}
_BlockSize ("BlockSize", int) = 4
_Radius ("Radius", Range(0.001, 100)) = 10
}
SubShader
@knasa21
knasa21 / TemplateArrayPtr.cs
Created July 9, 2019 15:26
UnityでDLLを利用する際に配列をIntPtr型として管理しやすくするジェネリッククラス
using System;
using System.Runtime.InteropServices;
/// <summary>
/// 配列をメモリ確保してIntPtrで扱うためのジェネリククラス
/// </summary>
/// <typeparam name="T"></typeparam>
public class TemplateArrayPtr<T>
{
public T[] Array { get; set; }
@knasa21
knasa21 / CameraGyro
Last active April 12, 2018 16:53
スマホ横もちの時のカメラ回転をジャイロでできるようにするスクリプト。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraGyro : MonoBehaviour
{
void Start()
{
Input.gyro.enabled = true;
}
@knasa21
knasa21 / CameraGyro
Created April 12, 2018 16:37
Androidスマホ横もちの時のカメラ回転をジャイロでできるようにするスクリプト
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraGyro : MonoBehaviour
{
void Start()
{
Input.gyro.enabled = true;
}
@knasa21
knasa21 / ShowVerticesNormals.cs
Created February 2, 2018 17:54
頂点法線の可視化
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class ShowVerticesNormals : MonoBehaviour
{
@knasa21
knasa21 / CustomPlane.cs
Created October 16, 2017 16:48
頂点数と長さを変えられるPlaneを生成する
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(MeshRenderer))]
[ExecuteInEditMode]
public class CustomPlane : MonoBehaviour
{
[Range(1, 1000)]
public int cols = 1, rows = 1;
[Range(0.01f, 100.0f)]
@knasa21
knasa21 / ShowMeshIndex.cs
Last active November 12, 2017 05:27
メッシュの頂点インデックス可視化
using UnityEngine;
[ExecuteInEditMode]
public class ShowMeshIndex : MonoBehaviour
{
[Range(0.0f, 10.0f)]
public float vertexSize = 1;
public Color vertexColor;
[Range(0, 50)]
public int fontSize = 10;
@knasa21
knasa21 / MainPage.xaml.cs
Last active March 23, 2023 08:57
テキストボックスの中身をUDPで送信するUWPアプリ
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Foundation.Collections;
@knasa21
knasa21 / UDPClientUWP.cs
Last active May 9, 2018 21:30
HoloLens用UDP受信プログラム(ClientじゃなくてServerかな)
using UnityEngine;
using UnityEngine.Assertions;
using System.Text;
#if UNITY_EDITOR
using System.Net;
using System.Net.Sockets;
#else
using System;
using System.IO;