Shader Error: variable 'col' used without having been completely initialized

When I did the steps at 7:13, I saw a shader error. It says that variable 'col' used without having been completely initialized. I have no idea what happened nor what I should do. The following are the shader error and the corresponding code.


I googled the problem and I came up with the following.

But it still does not work. I am using Unity 2021.3.3f1. Any idea what I should do?

  • Martin Bergwerf replied

    Sorry, I'm afraid I don't know Unity or  GLSL, but (stupid idea, probably), if the compiler is complaining that col is not initialized, couldn't you simply initialize it, when it is declared... so, change  line 36 to something like:    half4 col = 0;


      

  • Omar Domenech replied

    Let me quote Gandalf here "This foe is beyond any of you...RUN!"

    I'm sorry Dian, this is very technical and beyond me, maybe Blanch can face this horror from the underworld. I have faith you can make a deep dive researching and figure it out man. Be the Tony Stark you know you are. 

  • Adrian Bellworthy replied

    Hey aalonaeon,

    I tested this script with Visual Studio, it returned no errors, which confirms my suspicions,

    Unfortunately the problem you are experiencing is because of the extensive changes to Unity's Shader Graph over the past 3 or 4 years.

    As this course is older than the changes made to the Shader Graph in Unity, the decision has been made to archive this course, as CGCookie is transitioning away from Unity.

    If you wish to continue learning about the Shader Graph in Unity, I recommend Unity Learn, this is Unity's own training site. You will probably need to login, creating an account is completely free, and there is a huge amount of content.

    Sorry for the inconvenience.

    Happy Blending!