Skip to content

Instantly share code, notes, and snippets.

@mao-test-h
mao-test-h / SourceEditorCommand.swift
Created Dec 10, 2020
Xcode Source Editor Extensionsを用いてprintメソッドの内容を全てもなふわすい〜とる〜むのURLに変更する為のEditor拡張
View SourceEditorCommand.swift
import Foundation
import XcodeKit
// このGistでは実装のコア部分である`SourceEditorCommand.swift`のみアップ (実装は適当)
// Xcode Source Editor Extensionsの導入に関しては以下を参照
//
// - Creating a Source Editor Extension
// https://developer.apple.com/documentation/xcodekit/creating_a_source_editor_extension
//
// - Xcode Source Editor Extension を使った Xcode プラグインの作り方
@mao-test-h
mao-test-h / EnableBackgroundAudio.mm
Last active Nov 21, 2020
Unity iOSビルドにてオーディオのバックグラウンド再生を行なう
View EnableBackgroundAudio.mm
#import <AVFoundation/AVFoundation.h>
@interface EnableBackgroundAudioWrapper : NSObject
+ (void)enableBackgroundAudio;
@end
@implementation EnableBackgroundAudioWrapper
+ (void)enableBackgroundAudio {
AVAudioSession* audioSession = [AVAudioSession sharedInstance];
@mao-test-h
mao-test-h / ProcessInfoWrapper.mm
Last active Nov 28, 2020
Unity上からiOS端末の発熱状態を取得する
View ProcessInfoWrapper.mm
#import <Foundation/Foundation.h>
@interface ProcessInfoWrapper : NSObject
// 結果はNSProcessInfoThermalStateに準拠
// - https://developer.apple.com/documentation/foundation/nsprocessinfothermalstate?language=objc
+ (int)getThermalState;
@end
@implementation ProcessInfoWrapper
@mao-test-h
mao-test-h / FinalSword_LEVELUp_Effect.swift
Created Jul 19, 2020
ファイナルソードの「LEVEL Up」演出っぽい挙動をSwiftUIで再現
View FinalSword_LEVELUp_Effect.swift
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 / CcacheSettings.cs
Created Apr 25, 2020
xcodeprojにccache向けの設定を適用するサンプル
View CcacheSettings.cs
#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 / CHANGELOG.md
Created Mar 26, 2020
UPM Custom Template
View CHANGELOG.md

UPM Custom Template

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

  • feature
    • sample
  • change
    • sample
  • fix
    • sample
@mao-test-h
mao-test-h / ExportPackage.cs
Created Mar 4, 2020
ProjectSettingsを.unitypackage形式で出力
View ExportPackage.cs
using System;
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Linq;
namespace EditorUtility
{
static class ExportProjectSettings
{
@mao-test-h
mao-test-h / CompileTime.cs
Last active Jan 4, 2020
コンパイル時間計測 (Unity2018/2019対応版)
View CompileTime.cs
// 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 / MonafuwaUtility.cs
Created Dec 9, 2019
Unityのタイトルバーを「もなふわすい~とる~む」に設定出来るEditor拡張(Windows限定)
View MonafuwaUtility.cs
#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 / EndianConverter.cs
Created Dec 7, 2019
エンディアン変換
View EndianConverter.cs
// 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);