C# Resource.Load() "Image wont display when play"

Hello everyone,

I have followed this tread to load the texture on sprite,

link: http://answer.unity3d.com/questions/14748/c-resourcesload-problem.html

I get no error when i hit play button but the image wont load

This is the script that i altered:
public class LoadTexture : MonoBehaviour {

private Texture TestTexture;

void Start()
{
	Object temp = Resources.Load ("davao+rizal+park");
		if(temp == null)
			Debug.Log("Load Object Fail");

	TestTexture = Resources.Load ("davao+rizal+park") as Texture;
	if(temp == null)
		Debug.Log("Load Object Fail");
}

}

Hello GameVortex, "davao+rizal+park" is the name of the image. And the image is already in the game folder.

You are saying Game folder, but is the image in a folder explicitly named: "Resources"?

Sorry mates for the late reply got no internet during weekends, Done it already move image to resources folder and still it yield same result.

2 Answers

2

images should be in Resources folder as GameVortex said

There is many things to check for us :

Your image is in a Resources folder ?
Your image name is : “davao+rizal+park” or is this “davao”+“rizal”+“park” ?

When I load something I prefer to do this :

Resources.Load( "MyFile, typeof(ResultType) ) as ResultType;

And last of all your last test is probably a wrong copy/paste :

 if(temp == null)
       Debug.Log("Load Object Fail");

//Maybe more like this 

 if(TestTexture == null)
       Debug.Log("Texture load Object Fail");

Can you check all of this point for us ?

Yes the image is in the Resources folder, The image name is "davao+rizal+park" I will try to load the image like what you show, Thank you all for the help will update you for the results later