Skip to content

Instantly share code, notes, and snippets.

using UnityEngine;
using System.Collections.Generic;
public class EventReceiverSample : MonoBehaviour
{
public enum AnimType {
TYPE_1, TYPE_2, TYPE_3
}
/// <summary>【実行可能】引数の無い関数</summary>
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Profiling;
public enum TransformAccessType
{
transformAccess,
GetComponentAccess,
CachedTransform,
using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
public class SampleQRReader : MonoBehaviour
{
private string _result = "";
private WebCamTexture _webCam;
void Awake()
using UnityEngine;
using UnityEditor;
using System.IO;
/// <summary>
/// QRコード作成EditorWindow
/// </summary>
public class CreateQRCodeWindow : EditorWindow
{
private enum QRImageSize
using UnityEngine;
using ZXing;
using ZXing.QrCode;
/// <summary>
/// QRコードの作成と読み込みヘルパークラス
/// </summary>
public static class QRCodeHelper
{
/// <summary>
@baobao
baobao / InvokeCpp.cs
Last active February 23, 2025 15:47
C#からC++に文字列を送信する記事 https://shibuya24.info/entry/unity-cs-cpp-string 内のサンプルソースコード
// C#からC++に文字列を送信するC#側のコード
using System.Runtime.InteropServices;
using UnityEngine;
public class InvokeCpp : MonoBehaviour
{
[DllImport("TestDll.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void ReceiveString(string hoge);
void Awake()
@baobao
baobao / InvokeCpp.cs
Last active February 23, 2025 07:34
C#とC++間でint型データを送りあう方法サンプルコード https://shibuya24.info/entry/unity-cs-cpp-int
// C#とC++間でint型データを送り合うC#コード
using System.Runtime.InteropServices;
using UnityEngine;
public class InvokeCpp : MonoBehaviour
{
[DllImport("TestDll.dll", CallingConvention = CallingConvention.Cdecl)]
static extern int Additive(int a, int b);
void Awake()
@baobao
baobao / SendStructCppToCs.cs
Last active February 23, 2025 15:52
C#/C++間構造体データ送信サンプル http://shibuya24.info/entry/unity-cs-cpp-struct
// C#からC++に構造体を送るサンプル(C#側処理)
using System;
using System.Runtime.InteropServices;
public static class SendStructCsToCpp
{
[DllImport("TestDll.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void SendStruct(ref StructData output, IntPtr input);
public struct StructData
extern "C"
{
float _fooPluginFunction ()
{
return 42.8F;
}
}
using UnityEngine;
using UnityEngine.Playables;
// PlayableBehaviourを継承する
public class CustomPlayableBehaviour : PlayableBehaviour
{
private float _direction = 1f;
public Transform target;
public override void ProcessFrame(Playable playable, FrameData info, object playerData)