Skip to content

Instantly share code, notes, and snippets.

@enpel
enpel / UIScrollViewPool
Created May 26, 2015 13:32
GameObjectを再利用するための仕組み。
using UnityEngine;
using System.Collections;
using System.Linq;
using System.Collections.Generic;
public class UIScrollViewPool : MonoBehaviour
{
Stack<HogeItemComponent> stackIcons = new Stack<HogeItemComponent>();
// NGUIの場合はUIWidgetでなければ描画がおかしくなる。UnityUIとかならGameObjectでも良いかも?
@enpel
enpel / file0.cs
Last active March 1, 2016 12:18
UnityのAnimationのAnimationClipの末尾全部にFinishEventをぶっさすスクリプト ref: http://qiita.com/enpel/items/af03d8af700ff22eaee1
using UnityEngine;
using System.Collections.Generic;
using System.Collections;
using System;
[RequireComponent (typeof(Animation))]
public class AnimationFinishEventTrigger : MonoBehaviour
{
@enpel
enpel / file0.cs
Created September 13, 2016 08:38
ReactiveCollectionの変更を雑に取りたい時のアレ ref: http://qiita.com/enpel/items/4f81d36bf0431894f6bd
ReactiveCollection<Hoge> Hoges;
// Hogesにかかるあらゆる変更を取得する
IObservable<ReactiveCollection<Hoge>> observeChanged;
public IObservable<ReactiveCollection<Hoge>> ObserveChanged()
{
if (observeChanged == null)
{
observeChanged = Hoges.ObserveReplace().Select(x => Hoges)
.Merge(Hoges.ObserveCountChanged().Select(x => Hoges))
@enpel
enpel / file0.txt
Last active September 27, 2016 03:45
InvalidOperationException: The operation is not possible when moved past all properties (Next returned false) ref: http://qiita.com/enpel/items/57919314923bd1efc51a
// ここで表題のエラーが出る
EditorGUI.PropertyField(rect, action.FindPropertyRelative("targetPosition"));
@enpel
enpel / file0.txt
Last active October 21, 2016 05:10
[UniRx]2つのボタンの片方を押したら両方を無効化する奴を作ってみた ref: http://qiita.com/enpel/items/cdf6c517be137611219d
Button buttonA;
Button buttonB;
var disporserA = buttonA.ClickAsObservable()
.Subscribe(_ =>
{
Debug.Log("Aが押された");
}).AddTo(this);
var disporserB = buttonB.ClickAsObservable()

UVScroll

uvscroll

Sin 歪み

sinyugami

うねうね

uneune

個人的に使えそうなのをまとめたい
@enpel
enpel / GameObjectFindEditor.cs
Last active May 23, 2017 09:03
GameObjectを検索するEditor拡張パーツ
using UnityEngine;
using UnityEditor;
using UniRx;
using System.Linq;
using System;
public class GameObjectFindEditor
{
public string FindName { get; set; }
private string buttonName = "FindGameObject";
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public class HelpButton
{
private readonly GUIContent buttonContent;
private readonly string helpURL;
@enpel
enpel / ToonWithOutline.shader
Last active October 6, 2018 22:48
適当なトゥーンシェーダー
Shader "Unlit/toon"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_ShadowColor ("ShadowColor", Color) = (1,1,1,1)
_TextureBorder ("TextureBorder", Range(1,0)) = 0.7
_ShadowBorder ("ShadowBorder", Range(1,0)) = 0.3
_LambertCorrect ("_LambertCorrect", Range(1,0)) = 0.5
_MiddleShadow ("_MiddleShadow", Range(1,0)) = 0.5