新ブログはこちらです。
My note | パソコンやプログラミング関連で勉強したことの覚え書き
https://ugcj.com/
Unity関連は主にこちらのカテゴリーに分類しています。
「Unity」カテゴリーアーカイブ
https://ugcj.com/category/programming/unity/
これまで同様、Unityに関する覚え書きやLinux/サーバー関連の覚え書きを投稿していく予定にしています。
My note | パソコンやプログラミング関連で勉強したことの覚え書き
https://ugcj.com/
「Unity」カテゴリーアーカイブ
https://ugcj.com/category/programming/unity/
Shader.Find
でエラーとなる場合はAlways Included Shaders
を設定するとうまくいく場合があるそうです。var s = Shader.Find("Custom/Example");
Assert.IsNotNull(s); //error
Edit » Project Settings..
Graphics
タブのBuilt-in shader settings
のAlways Included Shaders
の項目に使いたいShaderを登録すると良いそうです。Tiling
とOffset
の値をスクリプトから設定したい場合はSetTextureScale
やSetTextureOffset
を使って次のような感じでできるそうです。Material material;
// Tiling
material.SetTextureScale("_MainTex", new Vector2(1.0f, 2.0f));
// Offset
material.SetTextureOffset("_MainTex", new Vector2(0.5f, 0.5f));
GetTextureScale
とGetTextureOffset
が使えるみたいです。{TextureName}_ST
の値を参照すると良いそうです。sampler2D _MainTex;
float4 _MainTex_ST;
_MainTex_ST.x; // Tilingのxの値
_MainTex_ST.y; // Tilingのyの値
_MainTex_ST.z; // Offsetのxの値
_MainTex_ST.w; // Offsetのyの値
{TextureName}_TexelSize
の方を参照するそうです。Get a Unity Student plan today | Free 3D & VR software for students | Unity - Unity Store
https://store.unity.com/academic/unity-student
GitHub Student Developer Pack - GitHub Education
https://education.github.com/pack
当サイトは、Unityのnewbieが勉強したことをメモするブログです。間違っているところも多々あると思いますので、そのつもりでご覧ください。
当サイトに関してのご意見等がありましたら、下記メールフォームより送信することができます。