I am working in app, using Vuforia Library in which i am using camera(device camera). I want to render 2d Texture(any .png or .jpg) on camera defined its coordinate and its size. I tried but my app always getting crash. I don’t know whats wrong i am doing. Please help me on That this will be great for me.

string tempPath = “/Assets/Images/119642-samsung-galaxy-note-2-picture-large.jpg”;

Texture2D tex = new Texture2D(400,350);
Resources.LoadAssetAtPath(tempPath, typeof(Texture2D));
renderer.material.mainTexture = tex as Texture2D;

Here above is what i am doing. Thanks in advance.

Resources.LoadAssetAtPath is only available in an editor script.

You need to put your picture in a Resources/ folder and then load it with Resources.Load without the extension.

Ex :
119642-samsung-galaxy-note-2-picture-large.jpg is in Assets/Resources/ folder.

Texture2D tex = Resources.Load("119642-samsung-galaxy-note-2-picture-large") as Texture2D;
renderer.material.mainTexture = tex;