Skip to content

Instantly share code, notes, and snippets.

@mao-test-h
mao-test-h / UITraitCollectionBridge.cs
Last active May 7, 2021 20:16
Unity上からiOS端末のダークモード判定を行う
using System.Runtime.InteropServices;
namespace iOSNative
{
/// <summary>
/// `UITraitCollection`のBridge
/// </summary>
/// <remarks>
/// - https://developer.apple.com/documentation/uikit/uitraitcollection
/// </remarks>
@mao-test-h
mao-test-h / EndianConverter.cs
Created December 7, 2019 19:52
エンディアン変換
// refered to:
// - https://takachan.hatenablog.com/entry/2018/03/10/020555
using System;
namespace Utility
{
internal static class EndianConverter
{
public static char Reverse(char value) => (char)Reverse((ushort)value);
@mao-test-h
mao-test-h / MonafuwaUtility.cs
Created December 9, 2019 18:17
Unityのタイトルバーを「もなふわすい~とる~む」に設定出来るEditor拡張(Windows限定)
#if UNITY_EDITOR_WIN
using System;
using System.Runtime.InteropServices;
using System.Text;
using UnityEditor;
namespace MonafuwaUtility
{
static class MonafuwaSweetRoomEditor
{
@mao-test-h
mao-test-h / CompileTime.cs
Last active January 4, 2020 16:50
コンパイル時間計測 (Unity2018/2019対応版)
// referred to:
// http://baba-s.hatenablog.com/entry/2019/05/22/084000
// https://forum.unity.com/threads/editorapplication-iscompiling-is-always-false.770126/
using UnityEngine;
using UnityEditor;
#if UNITY_2019_1_OR_NEWER
using UnityEditor.Compilation;
#endif
@mao-test-h
mao-test-h / ExportPackage.cs
Created March 4, 2020 12:52
ProjectSettingsを.unitypackage形式で出力
using System;
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Linq;
namespace EditorUtility
{
static class ExportProjectSettings
{
@mao-test-h
mao-test-h / CHANGELOG.md
Created March 26, 2020 13:03
UPM Custom Template

UPM Custom Template

[0.0.1] - 20xx-0x-0x

  • feature
    • sample
  • change
    • sample
  • fix
  • sample
@mao-test-h
mao-test-h / CcacheSettings.cs
Created April 25, 2020 20:54
xcodeprojにccache向けの設定を適用するサンプル
#if UNITY_IOS
using System.IO;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
namespace Samples
{
static class CcacheSettings
{
@mao-test-h
mao-test-h / FinalSword_LEVELUp_Effect.swift
Created July 19, 2020 22:22
ファイナルソードの「LEVEL Up」演出っぽい挙動をSwiftUIで再現
import SwiftUI
struct ContentView: View {
// Font
let fontSize: CGFloat = 90
// Animation
let startScale: CGFloat = 0.3
let endScale: CGFloat = 1.0
@mao-test-h
mao-test-h / ProcessInfoBridge.cs
Last active May 7, 2021 20:09
Unity上からiOS端末の発熱状態を取得する
using System.Runtime.InteropServices;
namespace iOSNative
{
/// <summary>
/// `ProcessInfo`のBridge
/// </summary>
/// <remarks>
/// - https://developer.apple.com/documentation/foundation/processinfo
/// </remarks>
@mao-test-h
mao-test-h / EnableBackgroundAudio.mm
Last active December 23, 2024 02:38
Unity iOSビルドにてオーディオのバックグラウンド再生を行なう
#import <AVFoundation/AVFoundation.h>
@interface EnableBackgroundAudioWrapper : NSObject
+ (void)enableBackgroundAudio;
@end
@implementation EnableBackgroundAudioWrapper
+ (void)enableBackgroundAudio {
AVAudioSession* audioSession = [AVAudioSession sharedInstance];