Skip to content

Instantly share code, notes, and snippets.

View gatosyocora's full-sized avatar

gatosyocora gatosyocora

View GitHub Profile
@gatosyocora
gatosyocora / AvatarPerformance.cs
Last active August 20, 2019 11:56
Unityでアバターの評価をおこなうためのエディタ拡張およびメソッド群
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.Linq;
namespace Gatosyocora
{
public class AvatarPerformance : EditorWindow
@gatosyocora
gatosyocora / Unzip_unitypackage.bat
Last active July 1, 2020 08:20
unitypackageを展開するbatファイル (cmdで引数にunitypackageを指定して使う)
@echo off
rem current character code
for /f "usebackq tokens=2 DELIMS=:" %%a in (`chcp`) do @set CHARCODE=%%a
chcp 65001 > nul 2>&1
rem unzip folder
set FOLDERNAME=unitypackage
if exist %FOLDERNAME% (goto FILE_TRUE) else goto FILE_FALSE
:FILE_TRUE
@gatosyocora
gatosyocora / AndroidManifest.xml
Created October 7, 2019 11:30
Quest用のAndroidManifest. Assets/Plugins/Androidに入れる
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.oculus.UnitySample" xmlns:tools="http://schemas.android.com/tools" android:installLocation="auto">
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
<application android:theme="@style/UnityThemeSelector" android:icon="@mipmap/app_icon" android:label="@string/app_name" android:isGame="true" android:banner="@drawable/app_banner">
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:screenOrientation="landscape" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:hardwareAccelerated="false">
<intent-filter>
<action android:name="android.intent.a
@gatosyocora
gatosyocora / RuntimeMaterialLoader.cs
Created October 11, 2019 12:28
Unityアプリで任意の場所にあるmatファイルをランタイムロードするプログラム(暫定なのでエラー処理とか書いてないです)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Windows.Forms;
using System.IO;
using YamlDotNet;
using YamlDotNet.RepresentationModel;
using System.Text.RegularExpressions;
// Copyright (c) 2019 gatosyocora
@gatosyocora
gatosyocora / AnimatorUtility.cs
Created October 18, 2019 17:16
UnityのAnimatorに関する便利な関数
using System.Collections.Generic;
using UnityEditor.Animations;
using UnityEngine;
using System.Linq;
using System.Text;
using System;
// Copyright (c) 2019 gatosyocora
// MIT License
@gatosyocora
gatosyocora / ComponentProperties.cs
Last active November 1, 2019 13:38
任意のコンポーネントのプロパティ名一覧を取得する (同じオブジェクトにつけてReload->コンポーネント選択->Show Properties)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class ComponentProperties : MonoBehaviour {
@gatosyocora
gatosyocora / GatoMaterialPropertyDrawer.cs
Last active April 20, 2023 08:41
ShaderLabのCustomMaterialPropertyDrawerのサンプル(区切り線, Texture2Dの1行表示, foldout)
using UnityEngine;
using UnityEditor;
using System;
namespace GatoMaterialPropertyDrawer
{
internal class LineDecorator : MaterialPropertyDrawer
{
private float spaceSize;
@gatosyocora
gatosyocora / git_commands.md
Last active May 25, 2021 17:22
忘れがちなgitのコマンドをまとめる
  • ファイルの変更はそのままで直前のコミットを取り消す(Windows)

    $git reset --soft "HEAD^"

  • gitignoreの変更を適用(管理しなくなったファイルの履歴も残さない(push前))

    1. $git rm -r --cached .
    2. $git add .
    3. $git commit --amend --no-edit
@gatosyocora
gatosyocora / VRCSDKChecker.cs
Last active May 5, 2020 09:43
VRCSDKがプロジェクトに入っているか調べる。入っている場合特定のシンボルを登録し、VRCSDKがないことによるコンパイルエラーを防ぐ
using UnityEngine;
using UnityEditor;
[InitializeOnLoad]
public class VRCSDKChecker
{
// 他のスクリプトでVRCSDKを使う部分に
// #if VRCSDK ~ #endif
// で囲うことでVRCSDKがないことによるコンパイルエラーを防げる
@gatosyocora
gatosyocora / flipImage.ps1
Created May 22, 2020 09:16
引数で受け取ったパスの画像を水平反転させるPowerShellのコード
Param(
[parameter(mandatory=$true)][String]$imageUrl
)
Add-Type -AssemblyName System.Drawing
$stream = [System.IO.FileStream]::new(
$imageUrl,
[System.IO.FileMode]::Open,
[System.IO.FileAccess]::ReadWrite)
$srcImage = [System.Drawing.Image]::FromStream($stream)