![]() ![]() You can attach there certain GameObject that shall be rendered or leave it empty to make the script look for every GameObject on scene that has either any Collider2D or Renderer component. The script has one field named target.Attach the script to the GameObject you created. ![]() To use my script add a GameObject somewhere on your scene.I always try to write self-explaining code but I feel it would be nice to say a few words of introduction. As I couldn't find any in the web I decided to share it here and hope it will help someone in the future. I'm probably pretty late with my answer but I needed a script doing exactly that so I used your guide, Peter77, and made myself a proper chunk of code. Now you only need to convert it to a PNG for example and save it to a file. When this finished, you should have a texture that contains the entire scene content. If the camera reached the right most position, you would start the process from the left again, but move it down. Copy the RenderTexture to the "level texture", located at (x=RenderTexture.width*2, y=0).Move the Camera to the further to the right by the RenderTexture's width.Copy the RenderTexture to the "level texture", located at (x=RenderTexture.width, y=0).Move the Camera to the right by the RenderTexture's width.Copy the RenderTexture to the "level texture", located at the top-left position (x=0, y=0).Call Camera.Render to render the visible area by the camera to the assigned RenderTexture.Move temporary Camera to the top-left bounds.Let's assume the texture is named "level texture".This can already become an issue I guess, because if the level is big you might need to allocate a texture with 100000x50000 pixels, which can easily cause to run out of memory or perhaps it's not even supported to create! Create a texture that is big enough to fit the witdh/height of bounds.The bounds is a rectangle that encapsulates all objects in the level. Assign the RenderTexture as "target" to the Camera. Create a temporary ortho Camera and a RenderTexture of size 1024x2014 pixels for example.Here is how my first attempt might look like: You should be able to do this with a editor scripting. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |