万年素人からHackerへの道

万年素人がHackerになれるまで殴り書きするぜ。

  • ・資産運用おすすめ
    10万円は1000円くらい利益
    資産運用ブログ アセマネ
    • ・寄付お願いします
      YENTEN:YYzNPzdsZWqr5THWAdMrKDj7GT8ietDc2W
      BitZenny:ZfpUbVya8MWQkjjGJMjA7P9pPkqaLnwPWH
      c0ban:8KG95GXdEquNpPW8xJAJf7nn5kbimQ5wj1
      Skycoin:KMqcn7x8REwwzMHPi9fV9fbNwdofYAWKRo

    C#

    MAUIを始めるのに参考になる

    Getting started with .NET MAUI (iOS) on an M1 Mac.

    C#で値型か参照型か

    C#

    https://stackoverflow.com/questions/7580288/how-to-determine-whether-t-is-a-value-type-or-reference-class-in-generic if (hoge is ValueType) { } if (typeof(Vector2).IsValueType) { }

    Nullable<T>

    C#

    https://araramistudio.jimdo.com/2019/05/16/c-%E3%81%AE%E5%80%A4%E5%9E%8B%E3%81%A7%E3%82%82null%E3%82%92%E6%89%B1%E3%81%88%E3%82%8B%E3%82%88%E3%81%86%E3%81%AB%E3%81%99%E3%82%8Bnullable/

    配列に無理やりAddつける

    C#

    Arrayはイミュータブルだが、でもどうしてもAddメソッドつけたい時 C# Add extension Append method to class array of type T - Stack Overflow using System; public static class ArrayExtensions { public static T[] Add<T>(this T[] array, params T[] ad</t>…

    AssetBundleでもScriptのジャンプできるように

    AssetBundleでのオブジェクトはScriptのジャンプできない。 Editor拡張で、 GameObject go = new GameObject(); // 非アクティブにしないとAwake呼ばれる. go.SetActive(false); go.AddComponent(target.GetType()); CustomGUI.ShowScriptLink(go.GetCompone…

    Nullableから普通の値にする時 C#

    C#

    キャストか.Valueのどっちがベターか? stackoverflow.com .GetValueOrDefault();があった・・。

    Animator.ResetTrigger

    Unity - スクリプトリファレンス: Animator.ResetTrigger 全てのトリガーをリセットしたいのに、1つをピンポイントで指定。面倒。 Animatorの拡張メソッドがあるといい。 /// <summary> /// Triggger全てリセット. /// </summary> /// <param name="self">Self.</param> public static void ResetTriggers(t…

    C# Linq 簡単に繰り返しのListを作る Linq

    {1, 1, 1}のリスト using System.Linq; IList hogeList = null; hogeList = Enumerable.Repeat(1,3).ToList(); 1が3つ

    Unity uGUIのRectTransformのpivot

    http://answers.unity3d.com/questions/1007886/how-to-set-the-new-unity-ui-rect-transform-anchor.html なので左上にするなら public static void SetPivotLeftUp(this RectTransform aRectTransform) { Vector2 vec2 = Vector2.one; vec2.Set(0.0f, 1.0f…

    UnityでinterfaceのList

    ReorderableListを使いたいが interfaceはシリアライズにできないので http://answers.unity3d.com/questions/783456/solution-how-to-serialize-interfaces-generics-auto.html https://msdn.microsoft.com/en-us/library/system.runtime.serialization.ise…

    Xamarinで実機転送遅い時

    iOS 9.0, Xamarin Studio, "waiting for debugger to connect..." - Stack Overflow 実はiPhone設定

    0件の配列でLinqのLast()ではエラー

    int[] hoge = {}; Debug.Log(hoge.Length); hoge.Last (); InvalidOperationException: Operation is not valid due to the current state of the object System.Linq.Enumerable.Last[Int32] (IEnumerable`1 source)

    Xamarin Realm C# Manageが非推奨

    // Update and persist objects with a thread-safe transaction realm.Write(() => { realm.Add(new Dog { Name = "Rex", Age = 1 }); }); https://realm.io/docs/xamarin/latest/#class-subsets

    C# Unity Spineの注意

    UnityでSpineを扱う際に覚えておきたいTIPS - Qiita ここは記事が古い コールバックこのように設定する。 // コールバックの設定. private void SetCallback(SkeletonGraphic skeletonGraphic) { skeletonGraphic.AnimationState.Complete += OnCompleteSpin…

    Unity パーティクルの色設定メモ C#

    private void SetParticle(Color color) { ParticleSystem.MainModule main = this.m_particle.main; main.startColor = new ParticleSystem.MinMaxGradient(color); }

    Inspector拡張でEditorのScript表示

    [CustomEditor(typeof(Hoge))] public class HogeEditor : Editor { public override void OnInspectorGUI() { MonoScript script = MonoScript.FromScriptableObject(this); script = EditorGUILayout.ObjectField(script, typeof(MonoScript), false) as M…

    C# Unity FindObjectOfType

    コンストラクタで呼べない、 FindObjectsOfType is not allowed to be called from a MonoBehaviour constructor (or instance field initializer), call it in Awake or Start instead. デストラクでやると? FindObjectsOfType can only be called from th…

    アニメーションの最後にスキップ Unity Animator

    https://forum.unity3d.com/threads/set-state-to-last-frame-of-animation-save-position-of-animation.276437/ animationならいくらでも情報があるが、Animatorにはあまりない。 animatorがインスタンス変数 int hash = Animator.StringToHash("ステートマ…

    C# Unity 「Save Project」のショートカット

    AssetDatabase.SaveAssets ();の動作は「Save Project」と同じ。 なのでショートカット作成しよう。 using UnityEditor; using UnityEngine; public class MyEditorWindow : EditorWindow { [MenuItem("File/Save Project %&s")] static void SaveProject() …

    UnityのuGUIでRectTransformが小数点が出た時のチェック

    よく、シーンがm_LocalScale: {x: 1.0000376, y: 1.0000376, z: 1.0000376}みたいになってるかと using UnityEditor; using UnityEngine; if (GUILayout.Button ("チェック")) { List<string> nameList = new List<string> (); RectTransform[] rectTransforms = GameObject.</string></string>…

    Unity C# ノードエディタ

    PlayMaker的なStateMachineの図みたいなのをEditorで作りたい BahaviorMachineという無料アセット有るけどdllだった・・・ https://www.assetstore.unity3d.com/en/#!/content/20280 https://forum.unity3d.com/threads/drawing-lines-in-the-editor.71979/ …

    1日でクラウドサービスをマスター! 全部できるまで帰しま10!

    コレに参加 http://japan.unity3d.com/blog/press/20161121 プロジェクト入れると変なワーニング・・・ A default asset was created for 'Assets/Etc/playGROWnd/playground/Audio/Musics/NewAudioMixer 1.mixer' because the asset importer crashed on it…

    自動で配置する機能を使った場合にRectTransformのHeightの取得 C# Unity

    自動で配置する機能を使った場合にRectTransformのHeightは "Some values driven by ContentSizeFitter"とかメッセージが出てそれで計算されているっぽい。 しかし、試しにRectTransformの rect.y とか rect.size.y とか sizeDelta.yでは0が返却される。 グ…

    SceneNameAttribute Unity C#

    2Dユニティちゃんのデモゲームが参考になった https://github.com/anchan828/property-drawer-collection/blob/master/SceneName/SceneNameAttribute.cs これ使えば [SceneName] [SerializeField] private string nextLevel; とか使える。

    Unity C# JsonUtility

    Unity - マニュアル: JSON 形式にシリアライズ 今更ながらJsonUtility using UnityEngine; using System.Collections; public class JsonTest : MonoBehaviour { // Use this for initialization void Start () { MyClass myObject = new MyClass (); myObje…

    選択オブジェクト数を表示 Unity

    [MenuItem("GameObject/選択GameObject数表示", false, 1)] static void CountSelectObjects(MenuCommand menuCommand) { int count = Selection.gameObjects.Length; // これがないと二度以上実行される. if (count > 1) { if(menuCommand.context != Selec…

    TimeScaleに影響されないレガシーアニメーション Unity C#

    GitHub - onevcat/UnpauseMe: Script for Unity3D, unpause Unity3D animations or particles when set Time.timeScale = 0. これ。 Animatorのならプルダウンでできるが、レガシーアニメーションはできない。 UnpauseMe/AnimationPlayIgnoreTimeScale.cs at…

    Unity EditorでArrayのbool, string

    面倒なので拡張 public static class Extends { /// <summary> /// Gets the bool array value. /// boolの配列を取得する. /// </summary> /// <returns>The bool array value.</returns> /// <param name="myProp">My property.</param> /// <param name="key">Key.</param> public static bool[] GetBoolArrayValue(this SerializedProp…

    Unityで古いXamarin Studioを使う

    Xamarin Studio がアップデートを促したので、 6にアップデートされてしまい、Unityのプロジェクトが上手く開かなくなった。 Outdated cask: xamarin-studio · Issue #17941 · caskroom/homebrew-cask · GitHub xamarin.ios - From where can I download xam…

    VS CodeのUnityのVSCode.cs

    https://msdn.microsoft.com/ja-jp/library/hh264221.aspx #if !UNITY_EDITOR_WIN // Make sure our reference framework is 4.0, still the base for Unity if (content.IndexOf("<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>") != -1) { content = Regex.Replace(content, "<TargetFrameworkVersion>v3.5</targetframeworkversion>