コガネブログ

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

2018-12-25から1日間の記事一覧

【Unity】デフォルトの AndroidManifest.xml が保存されている場所

概要 【Unity のインストール先】\Editor\Data\PlaybackEngines\AndroidPlayer\Apk 上記のフォルダにデフォルトの AndroidManifest.xml が保存されています

【Unity】TextMesh Pro でリッチテキストを除外したテキストを取得する方法

概要 var textUI = GetComponent<TMP_Text>(); textUI.text = "<size=64>ABCDEFG</size>"; textUI.ForceMeshUpdate(); var parsedText = textUI.GetParsedText(); // ABCDEFG Debug.Log( parsedText ); GetParsedText を使用する ForceMeshUpdate を使用しないと正常に結果が得られない…

【C#】容量を表すバイト単位の数値を単位付きの読みやすい文字列に変換する関数

ソースコード public static class FileUtils { public static string ToReadableSize( double size, int scale = 0, int standard = 1024 ) { var unit = new[] { "B", "KB", "MB", "GB" }; if ( scale == unit.Length - 1 || size <= standard ) { return …

【Unity】マテリアルで設定する時のシェーダの場所名を取得する方法

概要 シェーダファイルのこの部分をスクリプトから参照したい場合 public Shader m_shader; ... var name = m_shader.name; name プロパティにアクセスすれば取得できる

【Unity】Error launching XXXX for capture. Something went wrong connecting to the debugger on the Android device.

概要 Error launching XXXX for capture. Something went wrong connecting to the debugger on the Android device. RenderDoc で Android アプリを起動しようとしたところ、上記のエラーに遭遇した Development Build ではないアプリを起動しようとしてい…

【Unity】Feature `XXXX' cannot be used because it is not part of the C# 4.0 language specification

11# 概要 Feature `XXXX' cannot be used because it is not part of the C# 4.0 language specification Unity で上記のようなコンパイルエラーが発生した場合 Player Settings の「Scripting Runtime Version」を 「Experimental (.NET 4.6 Equivalent)」…

【Unity】Material does not have a _MainTex texture property. It is required for SpriteRenderer.

概要 Material does not have a _MainTex texture property. It is required for SpriteRenderer. Shader Graph で 2D 用のシェーダを作成できるかどうか試してみようと思い、 作成したシェーダをマテリアルに設定し、そのマテリアルをスプライトに割り当て…

【Unity】The current render pipline is not compatible with this master node.

概要 The current render pipline is not compatible with this master node. Shader Graph のマスターノードで上記のエラーが表示されている場合 Unity メニューの「Window>Package Manager」から 「Render-Pipelines.Lightweight」をインストールして Proj…

【Visual Studio】NuGet パッケージのキャッシュを削除する方法

概要 Visual Studio メニューの「ツール>NuGet パッケージ マネージャー> パッケージ マネージャー設定」を選択して 「すべての NuGet キャッシュをクリア」を押します 参考サイト様

【Unity】java.lang.RuntimeException: Unable to get provider com.voxelbusters.nativeplugins.extensions.FileProviderExtende

概要 「Cross Platform Native Plugins」を Unity プロジェクトに導入して Android ビルドしてみたところ、Android アプリが起動せず、 java.lang.RuntimeException: Unable to get provider com.voxelbusters.nativeplugins.extensions.FileProviderExtende…

【Unity】【Cross Platform Native Plugins】ダイアログやトーストを表示する方法

アセット 使い方 ボタン1つのダイアログ NPBinding.UI.ShowAlertDialogWithSingleButton ( _title : "タイトル", _message : "メッセージ", _button : "OK", _onCompletion : buttonText => Debug.Log( buttonText ) ); ボタン2つのダイアログ NPBinding.UI.…

【Unity】【Cross Platform Native Plugins】UUID の取得、ストアを開く、レビューの依頼、Bundle Version・Bundle Identifier の取得

アセット 使い方 UUID を取得 var uuid = NPBinding.Utility.GetUUID(); ストアのページを開く var id = NPSettings.Application.StoreIdentifier; NPBinding.Utility.OpenStoreLink( id ); レビューの依頼を表示 if ( NPSettings.Utility.RateMyApp.IsEnabl…

【Unity】Unity 上で Android の logcat が実行できるパッケージが Package Manager からインストールできるようになった(現在はプレビュー版)

はじめに Unity 上で Android の logcat が実行できるパッケージが Package Manager からインストールできるようになっていました 2018/12/25 現在はプレビュー版となっております 検証環境 Unity 2019.1.0a12 インストール方法 Unity メニューの「Window>Pa…

【Unity】Visual Studio で Boo.Lang の補間を無効化するエディタ拡張

概要 Visual Studio で List の using を追加しようとした場合、 通常だと「using Boo.Lang」も表示されてしまいますが 上記のスクリプトを Unity プロジェクトの「Editor」フォルダに追加して Visual Studio を閉じて再度 Unity から Visual Studio を起動…

【Unity】uGUI や SpriteRenderer で 5 種類のシェーダを使用できる「Sprite-Postprocessing-Tool」紹介

はじめに 「Sprite-Postprocessing-Tool」を Unity プロジェクトに導入することで uGUI や SpriteRenderer で 5 種類のシェーダを使用できるようになります 使用例 適用前 適用後 使い方 uGUI のオブジェクトやスプライトに「SpritePostprocessing」をアタッ…

【Unity】12 種類のシェーダを使用できる「EffectShader」紹介

はじめに 「EffectShader」を Unity プロジェクトに導入することで 12 種類のシェーダを使用できるようになります 紹介記事一覧 ドット柄のポストエフェクトを使用する 画面を歪ませるポストエフェクトを使用する アウトラインのポストエフェクトを使用する …

【Unity】uGUI で 3 種類のシェーダを使用できる「UIAndShader」紹介

はじめに 「UIAndShader」を Unity プロジェクトに導入することで uGUI で 3 種類のシェーダを使用できるようになります 紹介記事一覧 uGUI の Image で角丸を使用する uGUI で奥行きのある円形のレイアウトを使用する uGUI の Image が分解されるような演出…

【Unity】uGUI で 2 種類のシェーダを使用できる「UGUIEffect」紹介

はじめに 「UGUIEffect」を Unity プロジェクトに導入することで uGUI で 2 種類のシェーダを使用できるようになります 紹介記事一覧 uGUI で画像を波打たせる演出を実装する uGUI で波に反射するような影を実装する