0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

UnityのCustomEditorにてmaterial作成直後にsetTextureするとうまく反映されないことがある

Posted at

設定するも灰色のおそらくデフォルトカラーになってしまう。
原因はプロパティに対象変数の設定がないことだった。
UnityのshaderはPropertiesに設定がなくとも、uniformの変数があればそこへマテリアル経由で値を入れることができるが、マテリアル作成直後だとうまくいかなくなるらしい。
なお、プロパティが無いとgetTextureなどの関数も常時失敗するので、怪しければ基本的にプロパティに追加しておいたほうがいいのかも。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?