Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by otg2 · Apr 07, 2015 at 06:13 PM · unity 5errorshader

Shader worked in Unity 4.5, now Unity 5 kills it.

Good day everyone.

The shader that I constructed in Unity 4 worked perfectly and as I upgraded to Unity 5 it only gives me that ugly pink/purple color in game and debugs the error "Material doesn't have a float or range property "_T"".

Now what google has told me is that this error is just some bug if there is something else wrong with the shader. First it said that it was missing semantics at line 48, so I changed the name to v2f which gave me the material missing property error. The float value is not the problem, does someone spot anything else?

Anyone have any clue about what has changed in Unity 5 - shader wise? Does this have anything to do with DirectX11 or something like that?

Best regards.

 Shader "Custom/Ottar_VertexBasic" {
 //Texture : ShadowPlane_Tex_01
      Properties
     {
         _MainTex ("Particle Texture", 2D) = "white" {}
         _T("Transparency", Range(0,1)) = 1
     }
     
     SubShader {
         Tags
         {
             "Queue" = "Transparent"
             "IgnoreProjector"="True"
             "RenderType"="Transparent"
         }
         Blend SrcAlpha OneMinusSrcAlpha
         ColorMask RGB
         Alphatest Greater 0
         Lighting Off
         ZWrite Off
         Pass {
             CGPROGRAM
             #pragma vertex vert
             #pragma fragment frag
             #pragma multi_compile_builtin
             #pragma fragmentoption ARB_precision_hint_fastest
             #include "UnityCG.cginc"
             #pragma target 5.0
             
             float _T; 
             uniform sampler2D _MainTex;
             uniform float4    _MainTex_ST;
 
             struct a2v 
             {
                 float4 vertex : POSITION;
                 float4 texcoord : TEXCOORD0;
                 float4 color : COLOR;
             };
 
             struct v2f
             {
                 float4 pos : SV_POSITION;
                 float4 tex : TEXCOORD0;
                 float4 color; 
             };
 
             v2f vert(a2v v){
                 v2f o;
                 
                 o.color = float4(v.color.rgb, v.color.a);
                 
                 if(o.color.b == 1) 
                 {
                     o.pos = 0;
                     o.color.a = 0;
                 }
                 else
                 {
                     o.color.a =o.color.b;
                     o.tex = v.texcoord;
                     o.pos = mul (UNITY_MATRIX_MVP, v.vertex);            
                 }  
                 return o;
             }
             
             
             float4 frag(v2f i) : COLOR 
             {
                 half4 texcol = tex2D(_MainTex, i.tex.xy);
                 return texcol*i.color*_T;
             }
             ENDCG
         }
     }
 }
Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image rageingnonsense · Apr 07, 2015 at 09:42 PM 0
Share

If you rename _T, does it work? Silly question, but if it does why not just rename it?

avatar image otg2 · Apr 08, 2015 at 08:57 AM 0
Share

No it does not. It is a know bug according to other users that the debug manager does not really say what is wrong.

It added #pragma exclude renderer_ps3_d3d11 so I think it has something to do with that. But even if I disable d11 and change to d9 it still does not work.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by otg2 · Apr 11, 2015 at 03:17 PM

I found out! What a happy feeling to start a Saturday!

So - when I upgraded to unity 5 this was added to my cd code

 // Upgrade NOTE: excluded shader from DX11 and Xbox360; has structs without semantics (struct v2f members color)
 //#pragma exclude_renderers d3d11 xbox360

and in my v2f structure it was

 struct v2f
             {
                 float4 pos : SV_POSITION;
                 float4 tex : TEXCOORD0;
                 float4 color;
             };


So changing the last line to float4 color : COLOR0;

Fixed it. It was just missing a extra input which Unit 4 somehow allowed. Case closed

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Shader Forge can't work in Unity2017 0 Answers

Unlit Transparent Shader 0 Answers

Game Perfect in Unity 5 but not in Android Device 0 Answers

Animating y only on an object resembling a bomb 0 Answers

Unity 5's xCode build..... SUCKS? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges