■2D テクスチャの貼り付け(我流)
・あらかじめmaterialを作成し、透過処理したpng画像をセットしておく
※透過処理のしかたはWindows、Macで違うのでぐぐる
・Quadを作成して貼り付け
3D空間に2D画像を置く場合は、たぶんこっちの方が綺麗かと
■反転方法
左右のキーを押してテクスチャを反転するようなシーンを想定
public GameObject tex;
(中略)
if (Input.GetKey (KeyCode.RightArrow)) {
tex.GetComponent().material.mainTextureScale = new Vector2(1,1);
} else if (Input.GetKey (KeyCode.LeftArrow)) {
tex.GetComponent().material.mainTextureScale = new Vector2(-1,1);
(省略)
※ tex.GetComponentsではないので注意
要するに、Inspectorに出てるTilingとかOffsetは直接いじれないので、mainTextureScale とかを使ってねってこと
↓たいへん参考になったサイト様
http://neareal.net/index.php?ComputerGraphics%2FUnity%2FTips%2FScript%2FMaterial%2FEditMaterialsTiling
・あらかじめmaterialを作成し、透過処理したpng画像をセットしておく
※透過処理のしかたはWindows、Macで違うのでぐぐる
・Quadを作成して貼り付け
3D空間に2D画像を置く場合は、たぶんこっちの方が綺麗かと
■反転方法
左右のキーを押してテクスチャを反転するようなシーンを想定
public GameObject tex;
(中略)
if (Input.GetKey (KeyCode.RightArrow)) {
tex.GetComponent
} else if (Input.GetKey (KeyCode.LeftArrow)) {
tex.GetComponent
(省略)
※ tex.GetComponentsではないので注意
要するに、Inspectorに出てるTilingとかOffsetは直接いじれないので、mainTextureScale とかを使ってねってこと
↓たいへん参考になったサイト様
http://neareal.net/index.php?ComputerGraphics%2FUnity%2FTips%2FScript%2FMaterial%2FEditMaterialsTiling