apply jpg texture to game object

I want to create a primitive and apply a pict.jpg that I have dragged into the assets folder. All the examples I’ve seen want you to do
myprimitive.renderer.material.mainTexture=Resources.Load(“pict”);//this works.

According to the docs though you can assign a texture like this
var texture : Texture;
renderer.material.mainTexture = texture;

When I load a jpg into assets it looks like it’s a texture in the inspector, but
renderer.material.mainTexture=“pict”; //does not work

Does resources load have to be used to apply a texture?

Thanks,
Dan

I think you need to load the texture into a texture object if you want to assign it later.

So create a texture variable like the docs states, then load the texture into that.
Later on, when you need it, assign the variable to the mainTexture property.