Skip to content

Instantly share code, notes, and snippets.

// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using System;
using System.Linq;
using System.Reflection;
using UnityEditor;
// using UnityEditor;
using UnityEngine;
@ousttrue
ousttrue / tasks.json
Last active March 11, 2020 10:35
Display changes of environment variables by vcvars64.bat
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "meson build --backend vs",
"options": {
@ousttrue
ousttrue / CMakeLists.txt
Created June 3, 2019 13:39
emscripten glfw3 or webgl sample
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0)
PROJECT(em_gl VERSION 0.1.0)
LINK_DIRECTORIES(
$ENV{VCPKG_ROOT}/installed/x64-windows/lib
)
FILE(GLOB SRC
*.cpp
*.h
@ousttrue
ousttrue / d3d11_createdevice.d
Last active April 8, 2019 13:48
minimum win32api sample
//
// add d3d11 to libs in dub.json
//
import core.runtime;
import core.sys.windows.windows;
extern (Windows)
{
enum D3D_DRIVER_TYPE
{
using UnityEngine;
public class CubeBar : MonoBehaviour
{
[SerializeField, Range(0, 1)]
float m_value;
// キューブ付ける
[SerializeField]
@ousttrue
ousttrue / UNITY_PREPROCESSOR_DIRECTIVES.md
Created February 26, 2018 06:01
unity preprocessor directives memo

UNITY_2017_3_OR_NEWER

mesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
@ousttrue
ousttrue / diff.patch
Created January 15, 2018 00:48
imgui patch for UWP build
diff --git a/examples/directx11_example/imgui_impl_dx11.cpp b/examples/directx11_example/imgui_impl_dx11.cpp
index 0442d78..48e971b 100644
--- a/examples/directx11_example/imgui_impl_dx11.cpp
+++ b/examples/directx11_example/imgui_impl_dx11.cpp
@@ -547,6 +547,7 @@ void ImGui_ImplDX11_Shutdown()
g_hWnd = (HWND)0;
}
+#ifndef UWP
void ImGui_ImplDX11_NewFrame()
@ousttrue
ousttrue / AlphaClip.cs
Last active May 2, 2018 11:57
A custom timeline track for Unity2017.3. File name must be same as class name at clip and track.
using System;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
public class AlphaBehaviour : PlayableBehaviour
{
public float Alpha;
}
@ousttrue
ousttrue / Pin.cs
Created December 21, 2017 18:53
Pin disposable
public static class Pin
{
public static Pin<T> Create<T>(ArraySegment<T> src)where T: struct
{
return new Pin<T>(src);
}
public static Pin<T> Create<T>(T[] src) where T : struct
{
return Create(new ArraySegment<T>(src));
}
@ousttrue
ousttrue / cmake_vs2017_uwp_286.bat
Created December 11, 2017 09:28
cmake for UWP
@echo off
FOR /F "TOKENS=1,2,*" %%A IN ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" /v "15.0"') DO IF "%%A"=="15.0" SET VSPATH=%%C
@echo on
set CMAKE="%VSPATH%\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe"
set BUILD_DIR="build_vs2017_uwp_x86"
if not exist %BUILD_DIR% mkdir %BUILD_DIR%
pushd %BUILD_DIR%
%CMAKE% -G "Visual Studio 15 2017" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 ..