.renderer.material.mainTexture = Resources.Load("glass", Texture2D);

リファレンスみたいにキャストじゃなくて引数にしてみたら。それで動くかも知らんけど