2023-05-01から1ヶ月間の記事一覧
ソースコード using TMPro; using UnityEngine; namespace Kogane { public static class TMP_TextExtensionMethods { public static Vector3 GetCharacterLocalPosition ( this TMP_Text self, int index ) { var characterInfo = self.textInfo.characterI…
ソースコード using System; using Kogane; using UnityEngine; public sealed class Example : MonoBehaviour { [SerializeField] private Collider2D m_collider2D; private bool m_isHit; public event Action<Collider2D> OnEnter; public event Action<Collider2D> OnExit; priv</collider2d></collider2d>…
ソースコード using UnityEngine; namespace Kogane { /// <summary> /// Bounds 型の拡張メソッド /// </summary> public static class BoundsExtensionMethods { //================================================================================ // 関数(static) //====…
ソースコード public float desiredSpeed = 5f; // 一定に保ちたい速度 private Rigidbody2D rb; private void Start() { rb = GetComponent<Rigidbody2D>(); } private void FixedUpdate() { Vector2 velocity = rb.velocity; float currentSpeed = velocity.magnitude; </rigidbody2d>…
ソースコード import os from pathlib import Path def normalize_audio_folder(folder_path): # フォルダ内のすべてのファイルとサブフォルダを再帰的に取得します for root, _, files in os.walk(folder_path): for file in files: if file.endswith(".mp3…
概要 public static void UpdatePositionsFromLineRenderer ( this LineRenderer self, LineRenderer lineRenderer ) { var positionCount = lineRenderer.positionCount; self.positionCount = positionCount; for ( var i = 0; i < positionCount; i++ ) {…
ソースコード using Unity.Collections; using Unity.Mathematics; using UnityEngine; using UnityEngine.Splines; namespace Kogane { public static class LineRendererExtensionMethods { public static void UpdateFromSplineContainer ( this LineRend…
ソースコード #if UNITY_EDITOR using System; using UnityEditor; using UnityEngine; namespace Kogane { [InitializeOnLoad] public static class ScreenSizeChecker { public static event Action OnChanged; static ScreenSizeChecker() { var oldWidth…
概要 { "name": "$NAME$" } Rider の Assembly Definition File のファイルテンプレートは上記のように 名前だけを保持する形式になっているので各種パラメータを保持する形式に変更した Rider の設定で「ファイル | 設定 | エディター | ファイルテンプレー…
概要 公式ドキュメントの上記のページに記載されています この記事では Rider の新しい UI での手順を書き残しておきます Rider の Unity のツールバーを右クリックして「ツールバーのカスタマイズ」を選択して 「+」を押して 「アクションの追加」を押して …
概要 Debug.Log( m_image.sprite.texture.width ); Debug.Log( m_image.sprite.texture.height );
概要 private void LateUpdate() { var x = Mathf.LerpUnclamped( m_minX, m_maxX, m_scrollRect.horizontalNormalizedPosition ); // ... } LateUpdate で ScrollRect.horizontalNormalizedPosition を参照して ゲームオブジェクトの X 座標を設定しようと…
ソースコード using System.Collections.Generic; using DG.Tweening; using Unity.Collections; using UnityEngine; namespace Kogane { /// <summary> /// LineRenderer 型の DOTween 関連の拡張メソッド /// </summary> public static class DOTweenLineRendererExtensionMet…
概要 JetBrains Rider を 2023.1.1 にアップデートしたら フィールド名を変更した時に FormerlySerializedAs が自動で付与されるようになった Preferences を開いて「言語 & フレームワーク > Unity エンジン」の 「シリアル化されたフィールドの名前を変更…