Need help with simple Render to Texture problem

Hello,

can someone please help me with my problem.

I looking how for a way to Render the picture of a camera into a texture and
than using it as texture for a plane object.

But it should be done by Code because its not power of two and not with the “Render Texture asset”.

Would really appreciate any help.

Thanks.

RenderTexture class is only available in Unity Pro. That is a direct quote from the documentation.. As far as I know, this is the only way to render to a texture in Unity.

I do have the Pro version!

Then I don’t understand what you want to do. You say you want to avoid the RenderTexture asset, but from what I understand that is not possible.

While I don’t have the Pro license (and therefore cannot test this), the use of the RenderTexture class seems straight forward to me. There’s no need to use the editor to do this. If there are no caveats that I’m missing, then all you have to do is create a RenderTexture object, set the Camera’s targetTexture field to it, and then set the active material of your plane to that RenderTexture (and of course that depends upon what data the shader expects and what effects you’re trying to accomplish, et al.). Very basically, it can be done in two lines of code…

Camera.mainCamera.targetTexture = new RenderTexture(width, height, depth, format);
myGameObject.renderer.material.mainTexture = Camera.mainCamera.targetTexture;

http://docs.unity3d.com/Documentation/Components/class-RenderTexture.html

http://docs.unity3d.com/Documentation/ScriptReference/RenderTexture.html