Skip to content

Instantly share code, notes, and snippets.

Avatar

Shunsuke_Ishimoto TheStoneBook

View GitHub Profile
@TheStoneBook
TheStoneBook / TouchEventTest.cs
Last active Jun 25, 2018
【Unity】EventSystemを使ったタッチイベントの取得
View TouchEventTest.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class TouchEventTest : MonoBehaviour, IPointerDownHandler {
public void OnPointerDown(PointerEventData data){
//ここに処理を書く。
Debug.Log ("タッチしたよー!");
@TheStoneBook
TheStoneBook / ArrayShuffleTest.cs
Last active Jun 23, 2018
【Unity】配列のシャッフル
View ArrayShuffleTest.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ArrayShuffleTest : MonoBehaviour {
public GameObject[] Object;
void Start () {
@TheStoneBook
TheStoneBook / EndSECallBack.cs
Last active Jun 25, 2018
【Unity】SEの終了を知らせるコールバック
View EndSECallBack.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EndSECallBack : MonoBehaviour {
private AudioSource SE;
void Start () {
@TheStoneBook
TheStoneBook / ShuffleUseGuid.cs
Last active Jun 30, 2018
【Unity】GUIDを使って配列をシャッフルする。
View ShuffleUseGuid.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
using System;
public class ShuffleUseGuid : MonoBehaviour {
public GameObject[] Object;
@TheStoneBook
TheStoneBook / DragEventTest.cs
Last active Jul 1, 2018
【Unity】ドラッグでオブジェクトを動かす【EventSystem】
View DragEventTest.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
//CameraのProjectionはOrthographicに。
public class DragEventTest : MonoBehaviour,IDragHandler {
public void OnDrag(PointerEventData data){
Vector3 TargetPos = Camera.main.ScreenToWorldPoint (data.position);
@TheStoneBook
TheStoneBook / GuidSample.cs
Created Jul 1, 2018
【Unity】指定アセットファイルのGUIDを取得する。
View GuidSample.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using UnityEditor;
public class GuidSample : MonoBehaviour {
void Start () {
string t = AssetDatabase.AssetPathToGUID ("Assets/FileName");
@TheStoneBook
TheStoneBook / BoundsContainsTest.cs
Last active Jul 6, 2018
【Unity】Bounds.Containsのテスト
View BoundsContainsTest.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class BoundsContainsTest : MonoBehaviour,IDragHandler {
[SerializeField]
private GameObject EnteredObject;
@TheStoneBook
TheStoneBook / Collider2DOverlapTest.cs
Last active Jul 6, 2018
【Unity】ドラッグで動かしてるCollider2Dと指定のCollider2Dが重なってるかどうかを取得するテスト
View Collider2DOverlapTest.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class Collider2DOverlapTest : MonoBehaviour,IDragHandler {
[SerializeField]
private GameObject EnteredObject;
@TheStoneBook
TheStoneBook / AlphaMask.shader
Last active Jul 16, 2018
【Unity】シンプルなアルファマスクシェーダー
View AlphaMask.shader
Shader "Unlit/AlphaMask"
{
Properties
{
_MainTex ("MainTex", 2D) = "white" {}
_Mask("Mask",2D)="white"{}
}
SubShader
{
Tags { "RenderType"="Transparent"
@TheStoneBook
TheStoneBook / DecalCustom.shader
Created Jul 15, 2018
【Unity】2枚のテクスチャを重ねるシェーダー
View DecalCustom.shader
Shader "Unlit/DecalCustom"
{
Properties
{
_MainTex ("MainTex", 2D) = "white" {}
_SubTex("SubTex",2D)="white"{}
}
SubShader
{
Tags { "RenderType"="Opaque"