2023-01-01から1日間の記事一覧
概要 .asmdef を Reformat and Cleanup する時は JSON のコードスタイルの設定が適用されるので 「Editor > Code Style > JSON」の「Tabs and Indents」の 「Indent」を「4」にすると .asmdef のインデントの幅を 4 で保持できる
概要 「Tools > Actions on Save」の「Reformat and Cleanup Code」をオンにする
ソースコード using TMPro; using UnityEngine; namespace Kogane { public static class TextMeshProTagRemover { public static string Remove( string text ) { var gameObject = new GameObject(); var textMeshPro = gameObject.AddComponent<TextMeshPro>(); textMe</textmeshpro>…
はじめに <nobr>ピカチュウ<space=-3.75em><voffset=1em><size=50%>ぴかちゅう</size></voffset><space=1.25em> 上記のようなタグを使用して TextMesh Pro でルビを振る時に Alignment が左揃えならキレイに表示されるが 中央揃えや 右揃えだと表示位置が右にズレる現象に遭遇した (一行目がルビ無しの場合の正しい位置) ルビを振るテキ</space=1.25em>…
概要 <nobr>ピカチュウ<space=-3.75em><voffset=1em><size=50%>ぴかちゅう</size></voffset><space=1.25em> 上記のようなタグを使用して TextMesh Pro でルビを振る場合、 文字間隔(Spacing Options (em) の Character)が 0 だと正しい位置で表示されるが たとえば文字間隔を -8 にしているとこのようにルビの表示位置がズレてしまう <nobr>ピ</nobr></space=1.25em>…
概要 TextMesh Pro の FontAsset の Inspector の「Spacing Offset」で デフォルトの文字間隔を設定できる
概要 ScriptTemplates フォルダは Assets 直下に作らないと スクリプトテンプレートが認識されなかった
概要 error: Build input file cannot be found: '【XXXX】/Libraries/com.unity.services.core/Runtime/Device/UserIdProviders/NSUserDefaults.mm' (in target 'UnityFramework' from project 'Unity-iPhone') Xcode ビルド時に上記のエラーが発生してビル…
概要 Diagnostic switches are active and may impact performance or degrade your user experience. Switches can be configured through the Diagnostics section in the Preferences window. ProfileOpenCLJobs: False Preferences の「Diagnostics」を…
概要 ~/Library/Preferences/RiderXXX/config/resharper-host/GlobalSettingsStorage.DotSettings マニュアルには上記の場所に保存されていると記載されていたが ~/Library/Application Support/JetBrains/Rider2021.3/resharper-host/GlobalSettingsStorage…
ソースコード using UnityEngine; [DisallowMultipleComponent] public sealed class Example : MonoBehaviour { [SerializeField] private RectTransform m_uiTarget; [SerializeField] private Canvas m_canvas; private void Update() { var position = m…
ソースコード using System; public static class FloatExtensions { public static bool IsZero( this float self ) { return self.IsZero( float.Epsilon ); } public static bool IsZero( this float self, float epsilon ) { return Math.Abs( self ) < …
ソースコード using UnityEngine; [DisallowMultipleComponent] public sealed class Example : MonoBehaviour { [SerializeField] private float m_maxRotationSpeed; private void FixedUpdate() { var rigidbody2D = GetComponent<Rigidbody2D>(); rigidbody2D.angular</rigidbody2d>…
ソースコード using UnityEngine; [DisallowMultipleComponent] public sealed class Example : MonoBehaviour { [SerializeField] private float m_maxSpeed; private void FixedUpdate() { var rigidbody2D = GetComponent<Rigidbody2D>(); rigidbody2D.velocity = Vect</rigidbody2d>…
概要 上記のスクリプトを Unity プロジェクトに追加します 上記のように 2D Object の Circle と Square をシーンに配置します 壁となる Square には BoxCollider2D をアタッチします 球となる Circle には Rigidbody2D と CircleCollider2D、Example スクリ…