Skip to content

Instantly share code, notes, and snippets.

@kou-yeung
kou-yeung / Serialization.cs
Last active March 5, 2024 09:41
JsonUtility で List<T> と Dictionary<TKey,TValue> のシリアライズ
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
[Serializable]
public class Serialization<T>
{
[SerializeField]
List<T> target;
@kou-yeung
kou-yeung / FileSystem.cs
Created May 8, 2020 06:36
Unity WebGL FileSystem Sync
using AOT;
using System;
using System.Collections.Generic;
namespace WebGL
{
public static class FileSystem
{
#if UNITY_WEBGL && !UNITY_EDITOR
[DllImport("__Internal")]
@kou-yeung
kou-yeung / Move.cs
Last active November 9, 2018 06:12
using UnityEngine;
using Unity.Entities;
using Unity.Jobs;
using Unity.Burst;
using UnityEngine.Jobs;
using Unity.Transforms;
[System.Serializable]
public struct Move : IComponentData // ※ MonoBehaviour -> IComponentData に変更
{
@kou-yeung
kou-yeung / DLLTest.cs
Last active September 22, 2016 01:56
FileDialog DLL for Unity
// Unity用DLL作成
// 参考 : https://docs.unity3d.com/ja/current/Manual/UsingDLL.html
// 手順:
// Visual Studio を起動し [ファイル] > [新規作成] > [プロジェクト]を選択し
// VisualC# > Windows > クラスラライブラリ を作成する
// ※.今回は NET Framework3.5 にしました
//
// System.Windows.Forms の参照を追加
// ソリューションエクスプローラーに 参照を右クリックし参照の追加を選択する
// ※検索を使って System.Windows.Forms を検索すると見つかりやすいです
@kou-yeung
kou-yeung / EffekseerAssetBundleBuilder.cs
Last active September 4, 2016 07:19
EffekseerAssetBundleBuilder.cs
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Collections.Generic;
using System.Linq;
public class EffekseerAssetBundleBuilder
{
#if UNITY_5
// Bundles直下のディレクトリをAssetBundleとしてビルドする
REM Visual Studioのコマンドプロンプトのパスやプラットフォームの指定
SET CommandPromptPath="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
SET Platform=amd64
REM VS2015 x64 Native Tools Command Prompt起動
CALL %CommandPromptPath% %Platform%
REM nmake コマンドでビルドする
nmake
@kou-yeung
kou-yeung / Generic.cs
Last active May 22, 2016 11:47
Generic Construct for C#
using System;
public class Generic
{
public static T Construct<T>(params object[] p)
{
var types = new Type[p.Length];
for (var i = 0 ; i < p.Length; ++i) { types[i] = p[i].GetType(); }
return (T)typeof(T).GetConstructor(types).Invoke(p);
}