Skip to content

Instantly share code, notes, and snippets.

View TheStoneBook's full-sized avatar

Shunsuke_Ishimoto TheStoneBook

View GitHub Profile
@TheStoneBook
TheStoneBook / GetAngleUpToClockWise.cs
Last active August 28, 2018 07:10
【Unity】2点間の角度取得(上方向から時計回り & 角度範囲0~360)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GetAngleUpToClockWise : MonoBehaviour {
[SerializeField]
GameObject _start;
[SerializeField]
@TheStoneBook
TheStoneBook / GetAngleAtTwoVector2.cs
Last active August 25, 2018 15:22
【Unity】2点間の角度取得
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GetAngleAtTwoVector2 : MonoBehaviour {
[SerializeField]
GameObject _start;
[SerializeField]
@TheStoneBook
TheStoneBook / TestImage.png.meta
Last active July 22, 2018 19:38
【Unity】画像ファイルのmetaファイル
fileFormatVersion: 2
guid: f2f994c0d0f9b4a24b4c4615306b56ef
timeCreated: 1532129949
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
@TheStoneBook
TheStoneBook / TestScript.cs.meta
Last active July 22, 2018 19:39
【Unity】Scriptのmetaファイル
fileFormatVersion: 2
guid: 3bb1273c56536430d91e4721e0b33957
timeCreated: 1532123250
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- tex: {fileID: 2800000, guid: f2f994c0d0f9b4a24b4c4615306b56ef, type: 3}
- mat: {fileID: 2100000, guid: 85382f3e5c1c44090ad7ed361a4baf5c, type: 2}
@TheStoneBook
TheStoneBook / DecalCustom.shader
Created July 15, 2018 18:31
【Unity】2枚のテクスチャを重ねるシェーダー
Shader "Unlit/DecalCustom"
{
Properties
{
_MainTex ("MainTex", 2D) = "white" {}
_SubTex("SubTex",2D)="white"{}
}
SubShader
{
Tags { "RenderType"="Opaque"
@TheStoneBook
TheStoneBook / AlphaMask.shader
Last active May 22, 2023 15:07
【Unity】シンプルなアルファマスクシェーダー
Shader "Unlit/AlphaMask"
{
Properties
{
_MainTex ("MainTex", 2D) = "white" {}
_Mask("Mask",2D)="white"{}
}
SubShader
{
Tags { "RenderType"="Transparent"
@TheStoneBook
TheStoneBook / Collider2DOverlapTest.cs
Last active July 6, 2018 18:59
【Unity】ドラッグで動かしてるCollider2Dと指定のCollider2Dが重なってるかどうかを取得するテスト
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class Collider2DOverlapTest : MonoBehaviour,IDragHandler {
[SerializeField]
private GameObject EnteredObject;
@TheStoneBook
TheStoneBook / BoundsContainsTest.cs
Last active July 6, 2018 19:00
【Unity】Bounds.Containsのテスト
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class BoundsContainsTest : MonoBehaviour,IDragHandler {
[SerializeField]
private GameObject EnteredObject;
@TheStoneBook
TheStoneBook / GuidSample.cs
Created July 1, 2018 16:46
【Unity】指定アセットファイルのGUIDを取得する。
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 / DragEventTest.cs
Last active July 1, 2018 16:54
【Unity】ドラッグでオブジェクトを動かす【EventSystem】
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);