Skip to content

Instantly share code, notes, and snippets.

Tatsuhiko Yamamura tsubaki

Block or report user

Report or block tsubaki

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tsubaki
tsubaki / SingletonMonoBehaviourFast.cs
Last active Jul 20, 2019
少しだけ高速なシングルトン。初回検索を特定のタグから行う事で少しだけ高速化(倍〜3倍)。awakeフェイズ以降に呼び出す場合は以前と余り変わらず。
View SingletonMonoBehaviourFast.cs
using UnityEngine;
using System;
using System.Collections;
public abstract class SingletonMonoBehaviourFast<T> : MonoBehaviour where T : SingletonMonoBehaviourFast<T>
{
protected static readonly string[] findTags =
{
"GameController",
};
@tsubaki
tsubaki / ExportSprites.cs
Last active Jul 16, 2019
Load Multiple Sprite with scriptableObject
View ExportSprites.cs
using UnityEngine;
using System.Collections;
using UnityEditor;
public class ExportSprites {
[MenuItem("Assets/Create/SpriteScriptableObject")]
static void Export()
{
foreach (var sprite in Selection.objects) {
@tsubaki
tsubaki / LoadTexture.cs
Last active Jul 16, 2019
ネイティブプラグインが作成したテクスチャをUnityで使用するサンプル
View LoadTexture.cs
using UnityEngine;
using System;
using System.Runtime.InteropServices;
public class LoadTexture : MonoBehaviour {
[DllImport ("__Internal")]
private static extern IntPtr CreateTexture(string filename, out int w, out int h);
Texture2D tex = null;
View IJobParallelForFilterTest.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Jobs;
using UnityEngine.Jobs;
using Unity.Collections;
using Unity.Mathematics;
public class IJobParallelForFilterTest : MonoBehaviour
{
@tsubaki
tsubaki / CullingGroupSample.cs
Created Jan 7, 2016
CullingGroupの使用例
View CullingGroupSample.cs
using UnityEngine;
using System.Collections;
public class CullingGroupSample : MonoBehaviour {
private CullingGroup group = null;
private BoundingSphere[] bounds;
[SerializeField] Transform[] targets = null;
View LayerAnimation.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Animations;
public class LayerAnimation : MonoBehaviour {
PlayableGraph graph;
AnimationMixerPlayable mixer;
@tsubaki
tsubaki / SimpleAnimator.cs
Last active Jun 25, 2019
Animatorでアニメーションを再生する
View SimpleAnimator.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Animations;
using UnityEngine.Timeline;
[RequireComponent(typeof(Animator))]
[DisallowMultipleComponent]
public class SimpleAnimator : MonoBehaviour
@tsubaki
tsubaki / AutoSave.cs
Last active Jun 25, 2019
Auto Save scene(& prefab). and backup/rollback scene
View AutoSave.cs
using System.Collections;
using UnityEditor;
using UnityEngine;
using System.IO;
[InitializeOnLoad]
public class AutoSave
{
public static readonly string manualSaveKey = "autosave@manualSave";
@tsubaki
tsubaki / SpawnObject.cs
Last active Jun 20, 2019
AR Foundation create object
View SpawnObject.cs
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.ARFoundation;
[RequireComponent(typeof(ARSessionOrigin))]
public class SpawnObject : MonoBehaviour {
private ARSessionOrigin origin;
private List<ARRaycastHit> hitResults = new List<ARRaycastHit>();
@tsubaki
tsubaki / SomeAnimations.cs
Last active Jun 9, 2019
AnimationClipPlayableを使いまわす
View SomeAnimations.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Animations;
using UnityEngine.Profiling;
public class LoopSomeAnimations : MonoBehaviour
{
[SerializeField] AnimationClip[] clips = null;
You can’t perform that action at this time.