Skip to content

Instantly share code, notes, and snippets.

View the6th's full-sized avatar

HAYASHI Tomoki the6th

  • Nagoya,Japan
View GitHub Profile
@the6th
the6th / StdinReader.cs
Created April 17, 2021 12:06
UnityでCLIアプリケーションを作成するサンプル。Mono.Optionsでコマンドの解析
using Mono.Options;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
public class StdinReader : MonoBehaviour
{
private string stringValue = "";
private int number = 0;
@the6th
the6th / DisplayScript.cs
Last active January 3, 2021 03:56
Unityでマルチディスプレイ対応/メインディスプレイはWindow表示でResize可能
using UnityEngine;
public class DisplayScript : MonoBehaviour
{
void Start()
{
Debug.Log("displays connected: " + Display.displays.Length);
Display.displays[0].Activate();
Display.displays[1].Activate();
@the6th
the6th / DisableCameraTracking.cs
Created December 24, 2020 12:24
HoloLensを0Dofにする
using UnityEngine;
/// <summary>
/// HoloLensを0Dofにする。
/// <para>カメラの親要素(MixedRealityPlayspace)にAttachするスクリプト</para>
/// </summary>
public class DisableCameraTracking : MonoBehaviour
{
Transform cacheCamera;
void Start()
@the6th
the6th / TransformHelper.cs
Created May 19, 2020 03:52
World space rotation を local spaceに変換するHelper関数
using UnityEngine;
public static class TransformHelper
{
/// <summary>
/// World座標系のQuaternionを対象のTransformのlocalRotationに変換する
/// </summary>
/// <param name="target">対象のTransform</param>
/// <param name="worldRotation">World座標系のQuaternion</param>
/// <returns>localRotation</returns>
@the6th
the6th / UwcCommon.cginc
Last active May 2, 2020 05:34
uWindowCapture の ShaderをSinglePassInstancedに対応させる
// ## Repository
// * https://github.com/hecomi/uWindowCapture
// * https://github.com/hecomi/uWindowCapture/blob/7e1df4fee1a1c6d812079a4355cbb609686734f2/Assets/uWindowCapture/Shaders/UwcCommon.cginc
#ifndef UWC_COMMON_CGINC
#define UWC_COMMON_CGINC
#include "UnityCG.cginc"
using UnityEngine;
using System.Collections;
using System.IO;
public class SaveRenderTextureToJPG : MonoBehaviour
{
[SerializeField]
Renderer targetRenderer;
private void Start()
@the6th
the6th / Unity 2018.4.1f1は.NETビルドできない.md
Last active July 3, 2019 06:44
Unity2018.x ScriptingBackend .net

ScriptingBackend =.NETでのビルド結果

結論 Unity 2018.4.1f1は.NETにバグがある。IL2CPPはOK

検証内容

Unity Backend TargetSDK Build Solution Deploy to HL1 Sim(x86) Deploy to HL2 Sim(x86)
Unity 2018.3.14f1 .NET 10.0.17763.0 Success Success Success
Unity 2018.3.14f1 .NET 10.0.18362.0 Success Success Success
@the6th
the6th / Man_mldb.txt
Last active February 28, 2020 08:39
man of mldb
$ mldb
-d - directs command to the only connected USB device
returns an error if more than one USB device is present.
-s <specific device> - directs command to the device with the given serial number
or qualifier. Overrides ML_SERIAL environment variable.
-H - Name of mldb server host (default: localhost). Can also
be specified with MLDB_SERVER_HOST environment variable.
-P - Port of mldb server (default: 5038)
mldb devices [-l] - list all connected devices
('-l' will also list device qualifiers)
@the6th
the6th / CheckCameraPermision.cs
Last active May 22, 2019 02:33
HoloLens Unityアプリで、カメラへの許可がされているか確認する https://littlewing.hatenablog.com/entry/2018/12/21/191656
#if !UNITY_EDITOR && UNITY_WSA
using Windows.Media.Capture;
#endif
class Hoge:MonoBehaviour
{
#if !UNITY_EDITOR && UNITY_WSA
public async void funcA()
{
@the6th
the6th / cpu.bat
Created October 24, 2018 07:23
CPU 温度をbat で表示 管理者権限で実行/SJISで保存
@if(0)==(0) ECHO OFF
cscript.exe //nologo //E:JScript "%~f0" %*
@pause
GOTO :EOF
@end
// 温度を計測する間隔
var measure_interval_ms = 5000;