This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://twitter.com/TEST_H_/status/1023975602494169092 | |
using System; | |
using System.Diagnostics; | |
namespace MyContents | |
{ | |
class Test | |
{ | |
static void Main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MainContents.AudioUtility | |
{ | |
using UnityEngine; | |
// UE4のSoundCueを参考にしたもの。 | |
// 内容的にはAudioClipのラッパー的な立ち位置で、AudioClipを取得する際の振る舞いを実装するもの。 | |
// →例 : ランダムでClipを返すもの、配列に登録したClipを順番に取得など。 | |
// ※本当はinterfaceにしたいけどSerializeFieldで登録する都合上、敢えて基底クラスとする... | |
public abstract class AudioCue : ScriptableObject | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if UNITY_EDITOR && UNITY_WEBGL | |
namespace MyContents.Editor | |
{ | |
using UnityEngine; | |
using UnityEditor; | |
[InitializeOnLoad] | |
public class EditInitialSetting | |
{ | |
static EditInitialSetting() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Unlit/DokabenGeometry" | |
{ | |
Properties | |
{ | |
_MainTex ("Texture", 2D) = "white" {} | |
} | |
SubShader | |
{ | |
Tags |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Custom/Sprites/Dokaben" | |
{ | |
Properties | |
{ | |
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} | |
_Color ("Tint", Color) = (1,1,1,1) | |
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0 | |
[HideInInspector] _RendererColor ("RendererColor", Color) = (1,1,1,1) | |
[HideInInspector] _Flip ("Flip", Vector) = (1,1,1,1) | |
[PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// usage: | |
// [SerializeField] [ProgressBar] float _sample; | |
// [SerializeField] [ProgressBar("hoge")] float _sample; | |
// [SerializeField] [ProgressBar(0f, 1f)] float _sample; | |
// [SerializeField] [ProgressBar(0f, 1f, "hoge")] float _sample; | |
namespace Sample | |
{ | |
using System; | |
using UnityEngine; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace LowLevel.Unsafe | |
{ | |
using System; | |
using Unity.Collections; | |
using Unity.Collections.LowLevel.Unsafe; | |
public unsafe struct NativeObject<T> : IDisposable | |
where T : unmanaged | |
{ | |
[NativeDisableUnsafePtrRestriction] readonly T* _buffer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Unity2018.3からprivateな[SerializeField]が初期化しないと警告吐くようになってきたので、 | |
// 各CSソースを解析して一括で"= default;"を付ける奴。 | |
// ※ sedコマンドとかでも出来なくは無いが..改行や既存の代入などを踏まえるとこっちの方が早かった。 | |
namespace Tools // HACK: 適当なので都合に合わせて命名 | |
{ | |
using System; | |
using System.IO; | |
using UnityEngine; | |
using UnityEditor; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
using Unity.Collections.LowLevel.Unsafe; | |
namespace Unity.Collections | |
{ | |
/// <summary> | |
/// ネイティブメモリでの2次元配列のメモリ確保用ラッパー | |
/// </summary> | |
[NativeContainer] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Unity.Collections.LowLevel.Unsafe | |
{ | |
public static unsafe class NativeUtility | |
{ | |
public static NativeArray<T> PtrToNativeArray<T>(T* ptr, int length) | |
where T : unmanaged | |
{ | |
var arr = NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray<T>(ptr, length, Allocator.Invalid); | |
// これをやらないとNativeArrayのインデクサアクセス時に死ぬ |