Code in the start funciton not executed after the: rend.GetComponent<Renderer>(); line.

Hey guys I have a little problem that the code after the rend.GetComponent(); line does not seem to execute.

I tested this by writing a Debgu.Log Before and after that line and i didn’t get Response from the one after.

Anyway heres the code:

void Start ()
    {  
        Debug.Log ("1");
        rend.GetComponent<Renderer>();
        Debug.Log ("2");
        rend.material.shader = Shader.Find ("FresnelPack/Transparent Rim Unlit");
        rend.material.SetFloat ("_Scale", 0f);
    }

The code after the second Debug.Log is executed, it’s just not doing anything visible. I guess you were looking for: Renderer rend = GetComponent<Renderer>();

There are some situations were you don’t need a variable assignment since there’s no return value (things like list.Sorted()), but this is not one of them.

You are hiding errors in the console. I am guessing the renderer doesn’t exist and it’s throwing an exception.

hhahaah ok Nevermind my computer just crashed and started it back up again and everything works perfectly!

Maybe i just needed to restart unity

Anyway thanks guys for the fast replys