コガネブログ

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

2022-06-01から1ヶ月間の記事一覧

【Unity】TextMesh Pro 3.2.0-pre.3 以降でダイナミックフォントをリセットする方法

概要 TextMesh Pro 3.2.0-pre.3 以降で Font Asset の Inspector で右クリックして 「Clear Dynamic Data」を押すと ダイナミックフォントをリセットできます using System.Reflection; using TMPro; using UnityEditor; public static class Example { [Men…

【Unity】Uncaught (in promise) DOMException: The play method is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.

概要 自動再生はユーザーが承認したとき、サイト別設定で許可したとき、 またはメディアがミュートのときだけ許可されます。 Build.framework.js.gz:3:48743 Uncaught (in promise) DOMException: The play method is not allowed by the user agent or the …

【Unity】Uncaught (in promise) TypeError: e is undefined

概要 WEBGL_debug_renderer_info is deprecated in Firefox and will be removed. Please use RENDERER. Build.loader.js:1:9894 [UnityCache] Failed to load 'http://localhost:51173/Build/Build.data.br' from indexedDB cache due to the error: TypeEr…

【Unity】Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first.

概要 Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD Unity で WebGL ビルドしたら上記のエラーが発生して Audio が再生されない現象に遭遇した 上記の記事の対応を…

【Unity】Unity 2021 以降の WebGL でゲーム開始時に Audio が再生されない場合

概要 Audio Source の Play On Awake をオンにしたり m_audioSource.Play(); スクリプトから Awake や Start のタイミングで Play 関数を呼び出した場合、 Unity エディタでは正常に Audio が再生されても WebGL でビルドすると Audio が再生されなくなりま…

【Unity】NativeArray の for を簡単に実装できるようにする Rider の Source Template

ソースコード using JetBrains.Annotations; using Unity.Collections; public static class SourceTemplates { [SourceTemplate] [Macro( Target = "index" )] [Macro( Target = "value" )] public static void @for<T>( this NativeArray<T> self ) where T : st</t></t>…

【Unity】InvalidOperationException: Trying to release an object that has already been released to the pool.

概要 InvalidOperationException: Trying to release an object that has already been released to the pool. Unity のオブジェクトプールを使用した時に上記のエラーが発生する現象に遭遇した m_objectPool.Release( gameObject ); すでにプールに戻されて…

【Unity】TextMesh Pro 3.2.0-pre.3 をインストールする方法

概要 Package Manager の「+ > Add package by name...」を選択して com.unity.textmeshpro と 3.2.0-pre.3 と入力して「Add」を押します

【Unity】A Native Collection has not been disposed, resulting in a memory leak. Enable Full StackTraces to get more details.

概要 var animationDataArray = entityQuery .ToComponentDataArray<XXXX>( Allocator.TempJob ); ECS で上記のようなコードを書いたら A Native Collection has not been disposed, resulting in a memory leak. Enable Full StackTraces to get more details. こ</xxxx>…

【Unity】エディタのツールバーやステータスバーを非表示にできるエディタ拡張「Editor-View-Modules」紹介

はじめに 「Editor-View-Modules」を Unity プロジェクトに導入することで エディタのツールバーやステータスバーを非表示にできるようになります 使用例