コガネブログ

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

2023-03-01から1ヶ月間の記事一覧

【Unity】UniTask の拡張メソッド

リポジトリ 使用例 using System.Threading; using Cysharp.Threading.Tasks; using Kogane; using UnityEngine; public class Example : MonoBehaviour { private async UniTaskVoid Start() { var cancellationTokenSource = new CancellationTokenSource(…

【Unity】プレハブの編集が簡単になる PrefabUtility.EditPrefabContentsScope

通常 [MenuItem( "Tools/Hoge" )] private static void Hoge() { var assetPath = ""; var prefabRoot = PrefabUtility.LoadPrefabContents( assetPath ); foreach ( var x in prefabRoot.GetComponentsInChildren<SpriteRenderer>() ) { Object.DestroyImmediate( x ); } Pr</spriterenderer>…

【Unity】Object.Instantiate の拡張メソッド

リポジトリ 使用例 using Kogane; using UnityEngine; public sealed class Example : MonoBehaviour { public GameObject m_prefab; private void Awake() { var r1 = m_prefab.Instantiate(); var r2 = m_prefab.Instantiate( Vector3.zero ); var r3 = m_…

【Unity】Console ウィンドウで等幅フォントを使用する方法

概要 Console ウィンドウは通常は上記のような見た目ですが Console ウィンドウのタブを右クリックして「Use Monospace font」を押すと 等幅フォントを使用した見た目になります

【Unity】Generated streamable assets list has XXXX asset names and extensions

概要 Generated streamable assets list has XXXX asset names and extensions. Having more than 600 values might cause building errors in exported project. Consider using distinct extentions for streaming assets (such that are not used by othe…

【Unity】adb: failed to install YYYY.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package ZZZZ signatures do not match previously installed version; ignoring!]

概要 CommandInvokationFailure: Unable to install APK to device. Please make sure the Android SDK is installed and is properly configured in the Editor. See the Console for more details. /Applications/Unity/Hub/Editor/2022.1.23f1/PlaybackEn…

【Unity】Unknown error occurred while loading 'Assets/StreamingAssets/XXXX.prefab'.

概要 Unknown error occurred while loading 'Assets/StreamingAssets/XXXX.prefab'. UnityEngine.StackTraceUtility:ExtractStackTrace () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:37) UnityEditor.AssetDatab…

【Unity】AudioClip の再生遅延を解消する方法

概要 Unity メニューの「Edit > Project Settings...」を選択して 「Audio > DSP Buffer Size」を「Best latency」にします