コガネブログ

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

【Unity】エディタ拡張でビルドに失敗した時にも呼び出されるコールバックを実装する方法

概要 using UnityEditor; using UnityEditor.Build; using UnityEditor.Build.Reporting; using UnityEngine; public class Test : IPreprocessBuildWithReport { public int callbackOrder => 0; public void OnPreprocessBuild( BuildReport report ) { vo…

【Unity】Windows における WebGL で PlayerPrefs で保存したデータの保存場所(IndexedDB)

概要 Google Chrome C:\Users\【ユーザ名】\AppData\Local\Google\Chrome\User Data\Default\IndexedDB\【URL】 Mozilla Firefox C:\Users\【ユーザ名】\AppData\Roaming\Mozilla\Firefox\Profiles\【プロファイル名】\storage\default\【URL】 Microsoft Ed…

【Unity】iOS の WebView で自己署名証明書を使用しているサーバの Web ページを表示したい場合

概要 Unity でビルドした iOS アプリで「unity-webview」を使用して 自己署名証明書を使用しているサーバの Web ページを表示したい場合、 上記のサイト様で記載されている以下のコードを 「WebView.mm」に記述することで Web ページを表示できるようになる …

【Unity】Looks like you are rendering without using requestAnimationFrame for the main loop.

概要 Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates! W…

【Unity】CommandInvokationFailure: Unity Remote requirements check failed

概要 CommandInvokationFailure: Unity Remote requirements check failed C:/Program Files/Unity/Hub/Editor/2019.4.17f1/Editor/Data/PlaybackEngines/AndroidPlayer\SDK\platform-tools\adb.exe forward tcp:7201 tcp:7201 stderr[ error: no devices/em…

【ReSharper】編集したファイルの保存時に自動で Code Cleanup する方法

概要 Visual Studio メニューの「拡張機能 > ReSharper > Options...」を選択して 左メニューの「Code Editing > Code Cleanup > General」を選択して 「Automatically run cleanup when saving a file~」をオンにすることで ファイル保存時に自動で Code Cl…

【VSCode】Marp の default theme でセクションヘッダーは中央揃え、タイトルと本文は左上基準にする方法

通常 --- marp: true --- # タイトル --- # タイトル 本文1 本文2 本文3 セクションヘッダーは中央揃えタイトルと本文は左上基準 --- marp: true style: | section { justify-content: normal; } section.lead { justify-content: center; text-align: cent…

【Unity】ゲーム中にコンソールのようにコマンドを実行できる「UnityConsole」紹介

はじめに 「UnityConsole」を Unity プロジェクトに導入することで ゲーム中にコンソールのようにコマンドを実行できるようになります クイックスタート using UnityEngine; public class Example : MonoBehaviour { private void Awake() { // コンソールの…

【Unity】Addressable Asset System でビルドできるファイルかどうかを確認する方法

概要 using UnityEditor; using UnityEngine; public static class Example { [MenuItem( "Tools/Hoge" )] private static void Hoge() { var path = AssetDatabase.GetAssetPath( Selection.activeObject ); var mainAssetType = AssetDatabase.GetMainAsse…

【C#】XML のすべての要素を読み込むサンプル

C#

概要 using System; using System.Xml.Linq; class Program { static void Main() { var document = XDocument.Load( "【XML のファイルパス】" ); foreach ( var xElement in document.Descendants().Elements() ) { Console.WriteLine( xElement.Name ); }…

【Unity】C# スクリプトを開こうとすると Visual Studio の新しいインスタンスが起動してしまう場合

概要 Visual Studio で「ファイル変更の検出」ダイアログが表示されている時に Unity から C# スクリプトを開こうとすると Visual Studio の新しいインスタンスが起動してしまう現象に遭遇した Unity の Package Manager から Visual Studio Editor を削除し…

【雑記】DeNA TechCon 2021 の動画が見れる YouTube チャンネル

概要

【Unity】Script error: OnTriggerStay This message parameter has to be of type: [UNREGISTERED] The message will be ignored.

概要 Script error: OnTriggerStay This message parameter has to be of type: [UNREGISTERED] The message will be ignored. Unity で WebGL ビルドしたゲームを起動したら 上記のエラーが発生する現象に遭遇した Project Settings の「Player > Strip Eng…

【おすすめスライド】「ボトムアップドメイン駆動設計 後編」

スライド

【おすすめスライド】「ボトムアップドメイン駆動設計 前編」

スライド