27
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Unity] オブジェクトの透明度を操作する方法

Posted at

オブジェクトの透明度を取得・設定する手順

MeshRender コンポーネントを取得する

Meshrender meshrender = GetComponent<MeshRenderer> ();

Meshrender.material.color プロパティに、変更したい色を格納したColorオブジェクトを設定する。
ColorオブジェクトはRBGAの値持っているのでalphaを変えて透明度を操作する。
透明度は0.0が不透明、1.0が透明

meshrender.material.color = new Color(0, 0, 0, 1.0f);

シェーダーはTransparent > Diffuse を選択する。

スクリーンショット 2015-11-20 18.08.39.png

27
18
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
27
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?