unity
renderTex.Release(); renderTex.width = _stageWidth; renderTex.height = _stageHeight; renderTex.Create();
using UnityEngine; public class RenderTextureColorPicker : MonoBehaviour { [SerializeField] private RenderTexture _target; private Texture2D _texture; private void Awake(){ _texture = new Texture2D(_target.width, _target.height); } private…
//ARTrackedImageManager _trackedImageManager; void Awake() { _trackedImageManager.trackedImagesChanged += _onChange; } private void _onChange(ARTrackedImagesChangedEventArgs args){ List<ARTrackedImage> added = args.added; List<ARTrackedImage> updated = args.updated; List<ARTrackedImage></artrackedimage></artrackedimage></artrackedimage>…
PackageManagerからインストールする com.unity.visualeffectgraph ってキーワードでgitからインストールする Asset作る addComponent VisualEffectというコンポーネントを追加 作ったAssetをセットする 4つの構成要素 Visual Effect Graph 入門 - Qiita そ…
Custom Function ノード | Shader Graph | 10.0.0-preview.27 ファイルを作って、その中に書くとき stringをコピペするとき フォーマットが違う。 stringにかいた例 その他、参考 レーダースキャンしてるっぽいシェーダーを作りたかった(失敗) - 女子高生…
using System.IO; using UnityEditor; using UnityEngine; [ExecuteInEditMode] public class CapturePNG { private static int _index = 0; [MenuItem("Tools/Screen Capture")] public static void Capture() { var str = System.DateTime.Now.ToString("y…
シンプルに1pxの線を描く line rendererを使わず、の方法。 using System.Collections; using System.Collections.Generic; using UnityEngine; public class Lines : MonoBehaviour { [SerializeField] private MeshFilter _meshFilter; private Vector3[] …
Unity2020でバグがあるっぽい。検索窓に入力して出てこない時 左端のgitから追加するみたいなところからパッケージ名をいれる。com.unity.vectorgraphics 一覧 https://helpdesk.unity3d.co.jp/hc/ja/articles/900002171066-Unity-2020-1-%E3%81%8B%E3%82%89…
in fragment shader fixed4 frag (v2f i) : SV_Target { fixed4 col = float4(1,0,0,1); col = lerp(col,float4(0,1,0,1),smoothstep(0,0.333,i.uv.x)); col = lerp(col,float4(0,0,1,1),smoothstep(0.333,0.666,i.uv.x)); col = lerp(col,float4(1,0,0,1),s…
gist.github.com
in ARSession.cs Application.targetFrameRate = subsystem.frameRate; It seems that the frameRate is specified by subsystem. subsystemによって、フレームレートが指定されているようだ;(
以下を使わせていただきました。 UniDragAndDropForMac GitHub - baobao/UniDragAndDropForMac: A library that implements drag and drop in Unity's macOS build でも、使い方に悪戦苦闘しました。以下サンプルコードです。 WWWの使い方 IEnumeratorの使い…
// based https://p5js.org/examples/simulate-flocking.html using System.Collections; using System.Collections.Generic; using UnityEngine; public class Boids : MonoBehaviour { [SerializeField] private int NUM = 100; [SerializeField] BoidsPie…
canvasがunity editor上より大きくなったり、位置が少しずれたりします。 The canvas may be larger than in the unity editor, or slightly out of position.
#if UNITY_EDITOR Debug.Log( "JsonPath " + UnityEditor.AssetDatabase.GetAssetPath(textAsset) ); #endif
System.DateTime.Now.ToString("yyMMdd_HHmmss");
simple point cache file(.pcache) parser using UnityEngine; using System; public class PCacheParser { public static Vector3[] Parse(string text, int elements){ string str = text; string[] splitStr = {"end_header"}; string[] ary = str.Split(…
visual effect graph をpackage managerで入れる。 Window>VisualEffects>Utilities から Point cache bake tool でpcacheファイルを作る using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using System…
【Unite 2018 Tokyo】60fpsのその先へ!スマホの物量限界に挑んだSTG「アカとブルー」の開発設計 from UnityTechnologiesJapan002 www.slideshare.net public static float Normalize(ref Vector3 v) { // Magnitude関数のインライン化 float mag = (float)S…
If you use Microphone.Start(), the vibration on iOS doesn't seem to work. AudioServicesPlaySystemSound(soundId) on Obj-C does not work as well. Microphone.Start()を使っていると、バイブレーションが動かないようだ。
for smartphone and pc. 左右にドラッグできるUI タッチまたはマウスダウンで左右にドラッグするスクリプト。 スマホ、PC対応 めんどくさいので、もうつくりたくない・・ using System.Collections; using System.Collections.Generic; using UnityEngine; u…
毎フレームこれをやって、徐々に近づけた。 data.rotation = Quaternion.Lerp(data.rotation, tgtRot, 0.05f);
sceneビューでオブジェクトを中心にする ゲームオブジェクトが中心になるようにシーンビューをセンタリングするには、Hierarchy でゲームオブジェクトを選択し、マウスをシーンビューへ移動し、F を押します。メニューバーで Edit > Frame Selected を選択し…
AR FoundationをResetしたときのコード public static void ReloadMain(){ //ARKitリセット _arMeshManager.DestroyAllMeshes(); _arSession.Reset(); _arSession.enabled=false; _arSessionOrigin.enabled=false; Destroy(_arSession.gameObject); DOVirtua…
GetComponentsInChildren が入れ子の末端まで取得できる。スーパー便利。 _container.GetComponentsInChildren<MeshRenderer>() ※けどactiveSelf=trueじゃないと取得されないかも その場合は for(int i=0;i</meshrenderer>
How to get Enum from String YourEnumType parsed_enum = (YourEnumType)System.Enum.Parse( typeof(YourEnumType), your_string );
how to make a button on inspector https://kan-kikuchi.hatenablog.com/entry/CustomEditor_Button ExampleScript.cs using UnityEngine; [ExecuteInEditMode] //エディター再生してない時、動くように? 場合によって使う public class ExampleScript : M…
compute shaderをつかって頂点をベイクする using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; #if UNITY_EDITOR using UnityEditor; using System.IO; #endif public class MeshVertBaker2 : MonoBehavi…
bake vertices to texture2d using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; #if UNITY_EDITOR using UnityEditor; using System.IO; #endif public class MeshVertBaker1 : MonoBehaviour { [Seriali…
JSONObject使い方 import using UnityEngine; using System.IO; public class JsonLoader : MonoBehaviour { public TextAsset data; // private List<Vector3> _hoge; void Start() { Debug.Log(data.text); //読み込む var a = new JSONObject(data.text); var n = </vector3>…