Skip to content

Instantly share code, notes, and snippets.

View TakaakiIchijo's full-sized avatar

Takaaki Ichijo TakaakiIchijo

View GitHub Profile
@TakaakiIchijo
TakaakiIchijo / InputSystemObservableTriggerExtensions.cs
Created May 6, 2024 02:49
UnityInputSystemR3ObservableTriggerExtensions
using UnityEngine.InputSystem;
using R3;
namespace R3.Triggers
{
public static class InputSystemObservableTriggerExtensions
{
public static Observable<InputAction.CallbackContext> AsObservable(this InputAction action) =>
Observable.FromEvent<InputAction.CallbackContext>(
h =>
@TakaakiIchijo
TakaakiIchijo / UnityNetcodeForGameObjectsObservableTriggerExtensions.cs
Last active February 14, 2024 05:38
A piece of R3 extensions for Netcode for GameObjects
using Unity.Netcode;
namespace R3.Trigger
{
public static class UnityNetcodeR3Extensions
{
public static Observable<(T previousValue, T newValue)> AsObservable<T>(this NetworkVariable<T> networkVariable)
{
return Observable.FromEvent<NetworkVariable<T>.OnValueChangedDelegate, (T, T)>(
h => (previousValue, newValue) => h((previousValue, newValue)),
@TakaakiIchijo
TakaakiIchijo / UnityNetcodeUniRxExtensions.cs
Last active January 5, 2024 03:27
A piece of UniRx extensions for Netcode for GameObjects
using System;
using Unity.Netcode;
namespace UniRx
{
public static class UnityNetcodeUniRxExtensions
{
public static IObservable<(T previousValue, T newValue)> AsObservable<T>(this NetworkVariable<T> networkVariable)
{
return Observable.FromEvent<NetworkVariable<T>.OnValueChangedDelegate, (T, T)>(
@TakaakiIchijo
TakaakiIchijo / ConvertTimelineTextToVoiceWav.cs
Created December 9, 2023 09:17
Convert text to voice on timeline text track subtitles to wav files with A.I.VOICE for Games
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using UnityEngine;
using CsvHelper;
using UnityEditor;
using UnityEditor.Timeline;
using UnityEngine.Timeline;
@TakaakiIchijo
TakaakiIchijo / ExcludeTMPDefaultFontAssetInBuild.cs
Created January 9, 2023 05:10
Exclude TextMeshPro default font asset when build
#if UNITY_EDITOR
using System.Collections.Generic;
using System.Reflection;
using TMPro;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
public class ExcludeTMPDefaultFontAssetInBuild : IPreprocessBuildWithReport, IPostprocessBuildWithReport
@TakaakiIchijo
TakaakiIchijo / CriWareGameViewMuteButton.cs
Last active January 8, 2024 02:43
Enable the mute button on Game View when uses CRI ADX in Unity
using CriWare;
using UnityEditor;
[InitializeOnLoadAttribute]
public class CriWareGameViewMuteButton
{
private static bool isAudioMute = false;
static CriWareGameViewMuteButton()
{
@TakaakiIchijo
TakaakiIchijo / UnlockHideFlags.cs
Last active November 13, 2021 14:58
Unity EditorでHideFlagsつけたアセットをアンロックする右クリックメニュー拡張
public class SomeClass
{
[MenuItem("Assets/UnlockHideFlags")]
public static void UnlockHideFlags()
{
var selected = Selection.objects[0];
string targetPath = AssetDatabase.GetAssetPath(selected);
var asset = AssetDatabase.LoadAssetAtPath<Object>(targetPath);
EditorUtility.SetDirty(asset);
@TakaakiIchijo
TakaakiIchijo / DownloadAcbFromUnityCCD.cs
Created October 7, 2021 09:30
ADX for UnityのacbファイルをUnity Cloud Content Deliveryからダウンロード
public class DownloadAcbFromUnityCCD : MonoBehaviour
{
public CriAtomSource atomSource;
public string cueSheetName = {cuesheet name};
public string cueName = {cue name};
public string addressableRemotePathUrl = {Addressable Remote Path Url};
private IEnumerator Start()
{
var request = UnityWebRequest.Get(addressableRemotePathUrl+cueSheetName+".acb");
@TakaakiIchijo
TakaakiIchijo / CriWareAcbConverter.cs
Created April 7, 2020 06:26
ADX2のACBファイルからキューシート名とキュー名のConstクラスを生成するスクリプト
using System.Collections.Generic;
using System.IO;
using System.Text;
using UnityEngine;
using UnityEditor;
public class CriWareAcbConverter : Editor
{
private static CriAtomWindowInfo projInfo = new CriAtomWindowInfo();
private static string exportPath = Application.dataPath + "/CueDataConstants.cs";
@TakaakiIchijo
TakaakiIchijo / ADX2ExtensionsTask.cs
Last active March 20, 2020 03:53
UniTaskを使ってADX2のキューシートロードをawaitしてCriAtomCueSheetを戻り値で返してくれるやつ
using UniRx.Async;
public static class ADX2ExtensionsTask
{
public static UniTask<CriAtomCueSheet>.Awaiter GetAwaiter(this CriAtomCueSheet cueSheet)
{
UniTask<CriAtomCueSheet> task = new UniTask<CriAtomCueSheet>(async ()=>
{
await UniTask.WaitWhile(() => cueSheet.IsLoading);
return cueSheet;