5
1

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シェーダーエラー Parse error: syntax error, unexpected TOK_PASS, expecting TOK_SETTEXTURE or '}'

Last updated at Posted at 2019-01-21

#エラー構文

  • Parse error: syntax error, unexpected TOK_PASS, expecting TOK_SETTEXTURE or '}'

#原因
surfaceシェーダーの複数パスレンダリングの記述方法が間違っていた

Pass{
      CGPROGRAM

      ENDCG
}
Pass{
      CGPROGRAM

      ENDCG
}

と記述のするのはフラグメントシェーダーやバーテックスシェーダーの場合。

サーフェスシェーダーは

CGPROGRAM

ENDCG

CGPROGRAM

ENDCG

と記述する。

1パス目にサーフェスシェーダー、2パス目にバーテックスシェーダー等の場合は以下のように記述する。

CGPROGRAM
#pragma surface surf ~
ENDCG

Pass{
      CGPROGRAM
      #pragma vertex vert
      ENDCG
}
5
1
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
5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?