コガネブログ

平日更新を目標に Unity や C#、Visual Studio、ReSharper などのゲーム開発アレコレを書いていきます

Releasing render texture that is set as Camera.targetTexture!

概要 Releasing render texture that is set as Camera.targetTexture! Camera で Render Texture を使用しているシーンから 他のシーンに遷移したら上記のエラーが発生する現象に遭遇した iPhone、Android では発生せず、iPad でのみこのエラーが発生する状…

Windows でも Mac のようなショートカットキーで Delete・Redo できるようにするエディタ拡張

ソースコード

Display クラスで画面の元の解像度を取得する

概要 Screen.SetResolution で画面の解像度を変更した後に、元の解像度を取得したい場合は Display.main.systemWidth と Display.main.systemHeight を参照する 参考サイト様

TimeAPI を使用してサーバーの現在時刻を取得する例

ソースコード 参考サイト様

RevenueCat のエラーコードを列挙型で扱えるようにする

ソースコード

RevenueCat で UniTask を使えるようにする拡張メソッド

ソースコード

Android 端末の「日時を自動的に設定」と「タイムゾーンを自動的に設定」の設定値を取得できるクラス

ソースコード 使用例 using Kogane; using UnityEngine; public class Example : MonoBehaviour { private void Update() { Debug.Log( $"日時を自動的に設定: {AndroidDeviceDateTimeChecker.IsAutoTime}" ); Debug.Log( $"タイムゾーンを自動的に設定: {An…

Firebase 関連のパッケージを 11.8.1 にアップデートした時に遭遇した問題

iOS Android

SpriteRenderer.RegisterSpriteChangeCallback でスプライトが変更されたことを検知できる

使用例 using UnityEngine; public class Example : MonoBehaviour { [SerializeField] private SpriteRenderer m_spriteRenderer; private void Start() { m_spriteRenderer.RegisterSpriteChangeCallback( SpriteChangeCallback ); } private void OnDestr…

TMP_Text.OnSpriteAssetRequest を使うと sprite タグで Resources を使わないようにできる

使用例 using TMPro; using UnityEngine; public class Example : MonoBehaviour { [SerializeField] private TMP_SpriteAsset m_tmpSpriteAsset; private void Awake() { TMP_Text.OnSpriteAssetRequest += OnSpriteAssetRequest; TMP_SpriteAsset OnSprite…

Amazon のライブアプリテストで定期購入型アイテムの情報を取得できない場合

概要 Unity プロジェクトに RevenueCat を導入して Amazon のライブアプリテストで Purchases.GetProducts を実行したところ products が空で返ってくる現象に遭遇した nce you are ready, click on 'Submit IAP' at the top of the page. RevenueCat のドキ…

CommandServiceClient: CommandServiceException happened, retriesLeft=6

概要 CommandServiceClient: CommandServiceException happened, retriesLeft=6 com.amazon.a.a.n.a.a.c: COMMAND_SERVICE_NOT_INSTALLED: null: null at com.amazon.a.a.n.a.d.e(CommandServiceClient.java:257) at com.amazon.a.a.n.a.d.a(CommandServiceC…

EditorApplication.focusChanged や isFocused でエディタがフォーカスされているか確認できる

EditorApplication.focusChanged の使用例 using UnityEditor; using UnityEngine; [InitializeOnLoad] public static class Example { static Example() { EditorApplication.focusChanged += isFocused => { Debug.Log( isFocused ); }; } } EditorApplica…

iOS のサンドボックス環境でサブスクリプションの購入に失敗する場合

概要 <SKPaymentQueue: 0x282b3a740>: Payment completed with error: Error Domain=ASDErrorDomain Code=500 "Unhandled exception" UserInfo= {NSUnderlyingError=0x2827c4330 {Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" UserInfo={NSLocalizedDescription=Invalid S</skpaymentqueue:>…

「Editor Text Sharpness」でエディタの文字の見やすさを調整できる

概要 Unity 2023.1 から調整できるようになった?