Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Saving GameObjects as an image(2D)?[RESOLVED]

Discussion in 'Scripting' started by godfreyofbouillon158, Sep 17, 2018.

  1. godfreyofbouillon158

    godfreyofbouillon158

    Joined:
    Sep 14, 2018
    Posts:
    3
    Is it possible to save a set of GameObjects in a scene as a PNG with a script? To be more specific, I'm trying to implement a map generator similar to the one in this video for a roguelike in the same vein as Caves Of Qud but want to be able to save the generated maps as PNGs to store multiple levels at a time at the initialization for loading later.
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,955
    it sounds like storing them to png wouldn't be very efficient.. and those maps/images could be huge?

    or if you have fixed random seed generator, then you could just save the seed,
    and then generate required areas on the fly..?
     
  3. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    3,915
    Why save the maps as PNG instead of pure data, be it a binary stream or json or yaml or xml or your own custom format?
     
  4. godfreyofbouillon158

    godfreyofbouillon158

    Joined:
    Sep 14, 2018
    Posts:
    3
    I should have mentioned that I'm asking this hypothetically here, at the moment I just want to know if it's possible because...

    I have considered that, but wanted to have a visual representation of all the levels (I want to generate several at startup and load them as the player completes them) and this was the first idea that popped into my head. At the moment I'm not worried too much about efficiency as the maps are going to be small and there won't be many of them. Just a beginner trying to feel out what's possible and what's not.
     
  5. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,955
  6. godfreyofbouillon158

    godfreyofbouillon158

    Joined:
    Sep 14, 2018
    Posts:
    3