hello everyone i have this problem with the Resources.Load i did everything they say in the scripting ref i have created a folder in my unity game assets named as Resources and puted all my textures that i want to use in it but when i try to acces these textures in the script (change the texture of an object that i already have in my game ) i got my object with a default main color so that mean that Resources.Load did not work so if anyone know how he can resolve this problem please help me with this
here is a part of my script so you can verifie if i did something wrong thanx
thanx and sorry for my poor english
var onedh : Texture2D ;
var fivedh : Texture2D ;
var teendh : Texture2D ;
var malus : Texture2D ;
function Start(){
onedh =Resources.Load("1dh",Texture2D );
fivedh =Resources.Load("5dh" ,Texture2D );
teendh =Resources.Load("10dh",Texture2D );
malus =Resources.Load("malus" ,Texture2D );
}
function OnCollisionEnter(hit : Collision)
{
if(hit.gameObject.tag == "road" )
{collisioned =true;
//time on the road before destroy
if(this.gameObject.tag=="1dh"){
Destroy( this.gameObject.GetComponent("animatedimages"));
renderer.material.mainTexture =onedh ;
yield WaitForSeconds(1);
Destroy(this.gameObject);
}}