Good day to everyone who reads this.
I readed about scripting an functions but ii`am still confused.
When i load object:
var instance : GameObject=Instantiate(Resources.Load("title"));
(is a gray .obj format title), how cain i get reference to it`s renderer component?
trying to set texture:
instance.renderer.material.mainTexture = Resources.Load("glass");
Gives me error saying that there is no renderer, trying to:
instance.AddComponent("renderer");
gives me error saying: Can’t produce abstract class
PS i understand that this is a noob question but i`am missing something about accesing different
objects and components, can someone please explain what i am doing wrong?
bump (i`am sitting and wondering is this a really “noob” question, 30+ views and nobody can suggest something?)
The reason you can’t add Renderer as a component is that it is the base class for all the different types of renderer - it can’t be used as a component in itself. However, you shouldn’t need to add the renderer component yourself anyway. Create a instance of your prefab in the scene, just temporarily for testing purposes. Then, check in the inspector to see if it has a Mesh Renderer component (it will be invisible if it hasn’t). Also, does the root object actually have any geometry or is this on a child of the root? If it’s on a child, you will need to access the child with transform.Find and use its renderer.
Ty for your reply, i explain what iam trying to do in learning purposes. Task is simply trivial: Create a 100% scripted app that will be loaded in web player. This app will contain some mesh pieces (.obj) files in resource folder, so they will be included in scene, as some textures. Then app will generate a game level by command outside app depending on map code that i will pass to it, so it
s like level engine that will generate and paint (with textures) my desired level.
I think it is optimal solution becose it will contain just obj`s instead of 9999999999 levels 
And my first stpes: Created a emtpy game object from menu and asigned a new script wich will contain all functions and procedures for my task. As far i found useful comands like Resoureces.load and a few but i seem dont realy undestand the hierarhy... adressing... read all manuals, pdf
s, huge amount of forum posts… but stil…
i will noe try to understand your post, then will edit mine with what i`we reached. TY.
I think i understand my mistake, i tried to acces renderer component of an mesh directly, istead of making prefab in resource folder and loading and accesing it`s properties. So far so good, ty for idea.