- Home /
Question by
$$anonymous$$ · Feb 27, 2013 at 04:16 AM ·
texturetexturing
How To Add Textures To GameObjects?
Im New To Unity and i was wondering how to add textures to gameobjects. anyone got any answers? :)
Comment
Answer by appearance · Feb 27, 2013 at 06:39 AM
If you are new to unity, you can go through Unity's documentation and get some experience with samples provided by Unity.
Anyways, there are many ways to apply a textured material to your GameObject. You can create a material and select required shader and drag-n-drop your imported texture onto it. Then you can apply that material to your gameobject.
You can also apply a texture to a game object's material runtime:
public Texture2D myTexture; // Assuming that it has been linked to a texture imported into your project by drag-n-dropping that texture onto this property using Inspector window
void Start () {
gameObject.renderer.material.mainTexture = myTexture;
}
Check this documentation from unity.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
How to make a texture tile and not stretch 5 Answers
How to import obj file with multiple textures? 1 Answer