概要 [InitializeOnLoad] internal static class Example { static Example() { Debug.Log( ExampleSetting.instance ); } } InitializeOnLoad のタイミングで ScriptableSingleton にアクセスしたら UnityException: LoadSerializedFileAndForget is not al…
概要 File.Move(sourceFileName, destFileName); FileUtil.MoveFileOrDirectory( source, dest ); 上記の関数でアセットのファイル名を変更したら AssetDatabase.ImportAsset のタイミングで Importer(TextScriptImporter) generated inconsistent result fo…
概要 Unity の Project ウィンドウで画像を選択したら Unity エディタが強制終了する現象に遭遇した Assertion failed on expression: 'it != m_SendMap.end()' ================================================================= Native Crash Reporting …
概要 Unity エディタだと正常に動作するが iOS ビルドだと 「The referenced script on this Behaviour (XXXX) is missing!」が発生する現象に遭遇した Library フォルダを削除してからクリーンビルドしたら解決した
概要 Line Renderer が使用しているマテリアルの Shader を 「Sprites/Default」にしたら描画順が設定できるようになった
概要 using UnityEngine; using UnityEngine.EventSystems; public class Example : MonoBehaviour, IPointerClickHandler { public void OnPointerClick( PointerEventData eventData ) { Debug.Log( "OnPointerClick" ); } } 上記のようなスクリプトを Qua…
概要 シーンのカメラに Physics 2D Raycaster をアタッチして シーンに Event System を配置して スプライトに OnPointerEnter 検知用のスクリプトと Circle Collider 2D をアタッチして using UnityEngine; using UnityEngine.EventSystems; public class E…
概要 The target object is null. Check for missing scripts. Unity エディタで上記のエラーが発生する場合は 削除されたスクリプトを参照しているゲームオブジェクトが シーンに存在する可能性があります 「Missing」になっているスクリプトを右クリックし…
はじめに using UnityEngine; public class Example : MonoBehaviour { private void OnValidate() { Apply(); } private void Apply() { var rectTransform = GetComponent<RectTransform>(); rectTransform.sizeDelta = new Vector2 ( Random.Range( 0f, 100f ), Random.R</recttransform>…
参考サイト様
概要 [ResetStatic] public static bool IsInitialized { get; private set; } Cecil Attributes の Reset Static をプロパティに対して付与したら InvalidProgramException: Invalid IL code in XXXX:CecilAttributesGenerated_ResetStatics (): IL_0001: c…
概要 [ResetStatic] private static float? m_value; null 許容値型のフィールドに Reset Static を使ったら Unity 再生時にエディタがクラッシュする現象に遭遇した null 許容値型のフィールドに Reset Static を使わないようにしたらクラッシュしなくなっ…
概要 The package cache was invalidated and rebuilt because the following immutable asset(s) were unexpectedly altered: Unity で作業していたら上記の警告が出力されるようになった Unity を再起動したら出なくなった
【Unity】ビルド時に勝手に StreamingAssets フォルダが作られて UnityServicesProjectConfiguration.json というファイルが生成されるのを防ぐ方法
概要 「Version Control」パッケージが依存している 「com.unity.services.core」が勝手にフォルダやファイルを作成してしまうので Package Manager を開いて「Version Control」を選択して「Remove」する その後ビルドすると勝手に StreamingAssets フォル…
概要 [Package Manager Window] Cannot perform upm operation: Unable to add package [AAAA]: Package BBBB@AAAA has invalid dependencies or related test packages: CCCC (dependency): Package [CCCC@DDDD] cannot be found [NotFound]. UnityEditor.E…
概要 warning: You are currently using Visual Studio 2019 to compile and link C++ code. It is recommended that you upgrade to Visual Studio 2022 for better performance. Unity で PC 向けに IL2CPP ビルドしたらビルド完了時に上記の警告が出力さ…
概要 error: Build path contains project built with Mono scripting backend, while current project is using IL2CPP scripting backend. Consider building your project into an empty directory. Unity で PC 向けにビルドしたら上記のエラーが発生す…
概要 自動再生はユーザーが承認したとき、サイト別設定で許可したとき、 またはメディアがミュートのときだけ許可されます。 Build.framework.js.gz:3:48743 Uncaught (in promise) DOMException: The play method is not allowed by the user agent or the …
概要 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…
概要 Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD Unity で WebGL ビルドしたら上記のエラーが発生して Audio が再生されない現象に遭遇した 上記の記事の対応を…
概要 Audio Source の Play On Awake をオンにしたり m_audioSource.Play(); スクリプトから Awake や Start のタイミングで Play 関数を呼び出した場合、 Unity エディタでは正常に Audio が再生されても WebGL でビルドすると Audio が再生されなくなりま…
概要 InvalidOperationException: Trying to release an object that has already been released to the pool. Unity のオブジェクトプールを使用した時に上記のエラーが発生する現象に遭遇した m_objectPool.Release( gameObject ); すでにプールに戻されて…
概要 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>…
概要 Game ウィンドウの「Gizmos」をオンにすると描画される
概要 One or more cyclic dependencies detected between assemblies: Packages/com.unity.2d.animation/Editor/Unity.2D.Animation.Editor.asmdef, Packages/com.unity.2d.animation/Runtime/Unity.2D.Animation.Runtime.asmdef, Packages/com.unity.2d.ani…
概要 Library\PackageCache\com.unity.entities@0.50.1-preview.2\Unity.Entities\DefaultWorld.cs(26,25): error CS0117: 'JobsUtility' does not contain a definition for 'ClearSystemIds' Library\PackageCache\com.unity.entities@0.50.1-preview.2\Un…
概要 Unity の「Window > Rendering > Lighting」の 「Lighting Settings Asset」が設定されていない状態で Debug.Log( Lightmapping.lightingSettings ); 上記のようなコードを記述すると Exception: Lightmapping.lightingSettings is null. Please assign…
概要 Method XXXX.YYYY has invalid parameters. MenuCommand is the only optional supported parameter. MenuItem が適用された関数を定義した時に上記の警告が表示される現象に遭遇した using UnityEditor; using MenuCommand = System.ComponentModel.De…
概要 ArgumentException: Input Button XXXX is not setup. To change the input settings use: Edit -> Settings -> Input 上記のようなエラーが発生する場合、 using UnityEngine; public class Example : MonoBehaviour { private void Update() { if ( I…
概要 Unable to parse Build/XXXX.framework.js.gz! This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header "Content-Encoding: gzip" present. Check …