Skip to content

Instantly share code, notes, and snippets.

@naojitaniguchi
naojitaniguchi / Shuffle.cs
Created October 8, 2016 21:50
Shuffling array sample for Unity
using UnityEngine;
using System.Collections;
public class Shuffle : MonoBehaviour {
public int[] blockNums;
int[] blockIndexArray ;
// Use this for initialization
void setupArray(){
int total = 0 ;
@naojitaniguchi
naojitaniguchi / UniOSCSender.cs
Created August 4, 2016 04:15
Send OSC message by UniOSC
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using OSCsharp.Data;
namespace UniOSC{
/// <summary>
/// This class is a blueprint for your own implementations of the abstract class UniOSCEventDispatcher
/// Dispatcher forces a OSCConnection to send a OSC Message.
@naojitaniguchi
naojitaniguchi / UniOSCGetMessage.cs
Created August 4, 2016 03:42
Get OSC message by UniOSC
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using OSCsharp.Data;
namespace UniOSC{
public class UniOSCGetMessage : UniOSCEventTarget {
@naojitaniguchi
naojitaniguchi / MayaでSkydomeを設定してMental RayでGI
Created June 27, 2016 02:49
MayaでSkydomeを設定してMental RayでGI
1. Sphere Polygonを作る、名前をSkyDomeにしておく
2. equirectangularで画像で検索、適当にequirectangularの画像をダウンロードしておく
3. hypershadeで file[texture] ノードを作る
4. fileノードにダウンロードした画像を指定
5. hypershadeでsurfaceShaderを作る
6. SkyDomeにマテリアルを割り当てる
7. SkyDomeのスケールを調整 100とか
8. SkyDomeの背面の表示をoffにする SkyDomeShape -> RenderStatus -> Double Sided を offに
9. SkyDomeの影の設定をoffにするSkyDomeShape -> RenderStatus -> Casts Shadows, Receive Shadows を offに
10. レンダリング設定で Finall Gatherをonに Render Settings -> Quality -> Advanced Light Sampling -> Indirect Diffuse(GI) Mode で Finalgatherを選択
@naojitaniguchi
naojitaniguchi / publish.bat
Created June 2, 2016 07:54
windows batch file to publish rendered image and unity project files .
@echo off
rem publish batch file
rem set project root here
SET PROJ_ROOT=Y:\Pre2016TVED2\
rem set sequence shot cut here
SET SEQ_SHOT_CUT=seq\01unity\shot\s101\\c001
rem set unity_project here
SET UNITY_PROJ=project_01unity_s101c001
@naojitaniguchi
naojitaniguchi / SetValueToChildren.cs
Created May 25, 2016 05:06
Set value to children under target node
using UnityEngine;
using System.Collections;
public class SetValueToChildren : MonoBehaviour {
// Use this for initialization
void Start () {
}
using UnityEngine;
using System.Collections;
// マウスのボタンをあらわす番号がわかりにくかったので名前を付けた
enum MouseButtonDown {
MBD_LEFT = 0,
MBD_RIGHT,
MBD_MIDDLE,
};
@naojitaniguchi
naojitaniguchi / montage.sh
Last active January 15, 2016 00:37
tiling image with alpha channel by montage(ImageMagic)
montage -background none hoge*.png -tile 2X3 out.png
@naojitaniguchi
naojitaniguchi / SaveRenderTextureButton.cs
Created October 21, 2015 10:50
Get Pixel data from Render Texture and save Pixel data to .png file in button call back . Unity5
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.IO;
public class SaveRenderTextureButton : MonoBehaviour {
public Camera targetCamera;
public string saveFileName;
private Texture2D targetTexture;
@naojitaniguchi
naojitaniguchi / ButtonCallback.cs
Created October 21, 2015 09:38
GUI button callback sample for Unity5
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class ButtonCallback : MonoBehaviour {
// Use this for initialization
void Start () {
Button button = this.GetComponent<Button>();
button.onClick.AddListener(onClicked);