Skip to content

Instantly share code, notes, and snippets.

@sanukin39
sanukin39 / .gitignore
Last active February 5, 2022 03:23
My .gitignore
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
@sanukin39
sanukin39 / ObjectPool.cs
Created February 14, 2019 13:29
Simple object pool for Unity
using UnityEngine;
using System.Collections.Generic;
public class ObjectPool
{
private const string ObjectPoolPrefix = "Pool";
private readonly GameObject _target;
private readonly Transform _poolParent;
private readonly List<GameObject> _objects;
@sanukin39
sanukin39 / pre-commit-for-unity.sh
Created July 29, 2017 11:22
git pre-commit for unity and it check forgot to add the meta file
#!/bin/sh
#
# git pre-commit for Unity
# It check Forgot to add the meta file
# An alert is issued when a file has been added but no meta file has been added
#
# To enable this hook, rename this file to "pre-commit".
addfiles=`git diff --cached --name-status | awk '$2 != "A" { print $2 }'`
for file in $addfiles
@sanukin39
sanukin39 / UniFPSCounter.cs
Last active June 8, 2023 20:48
Simple FPS conter for Unity
using UnityEngine;
/// <summary>
/// ~ Fps counter for unity ~
/// Brief : Calculate the FPS and display it on the screen
/// HowTo : Create empty object at initial scene and attach this script!!!
/// </summary>
public class UniFPSCounter : MonoBehaviour
{
// for ui.
@sanukin39
sanukin39 / ActionPointManager.cs
Created November 23, 2016 14:41
ソシャゲによくある体力管理機能のサンプル
using UnityEngine;
using System;
using System.Collections;
public class ActionPointManager : MonoBehaviour {
// 1ActionPoint回復をするのに必要な時間
const int recoveryUnitSeconds = 180;
public int point { get; private set; }
@sanukin39
sanukin39 / ChangeEnvironment.cs
Created June 30, 2016 14:45
Unity Environment Swicher
using UnityEngine;
using UnityEditor;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
public class ChangeEnvironment {
[MenuItem("Environment/Develop")]
static void Develop(){
@sanukin39
sanukin39 / BatchBuildSample.cs
Created June 27, 2016 14:55
Unity BuildPipeline.BuildPlayer sample
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Linq;
using System.Collections;
public class BatchBuild {
// Android ビルド
[MenuItem("Build/Android")]
@sanukin39
sanukin39 / XcodeSettingsPostProcesser.cs
Last active October 11, 2023 16:04
Unity XcodeAPI Settings Sample
using System.IO;
using UnityEngine;
using UnityEditor;
using UnityEditor.iOS.Xcode;
using UnityEditor.Callbacks;
using System.Collections;
public class XcodeSettingsPostProcesser
{
@sanukin39
sanukin39 / removeAlpha.sh
Created May 2, 2016 06:39
imagemagickを使って一括でpngの透過除去を行うスクリプト(変換された画像はサブフォルダに出力される)
#!bin/sh
# 保存用のサブフォルダを作成
mkdir nonalpha
# 同フォルダ内にあるpngを取得
for file in `\find . -maxdepth 1 -type f -name '*.png'`; do
echo convert ${file}
convert ${file} \( +clone -alpha opaque -fill SkyBlue -colorize 100% \) +swap -geometry +0+0 -compose Over -composite -alpha off nonalpha/${file}
done
@sanukin39
sanukin39 / iosInspectionImageConverter
Last active May 2, 2016 05:02
imagemagickを使ってiOSのアプリ申請に必要なサイズの画像を一括で変換するスクリプト
#!bin/sh
array=('640x920' '640x1096' '750x1334' '1242x2208' '768x1024')
for dir in ${array[@]}; do
mkdir ${dir}
done
# 同フォルダ内にあるpng, jpgを取得
for file in `\find . -maxdepth 1 -type f -name '*.png' -or -name '*.jpg'`; do