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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Card PNG Builder in Unity

Discussion in 'Scripting' started by Nikewade, Jul 23, 2022.

  1. Nikewade

    Nikewade

    Joined:
    Sep 22, 2021
    Posts:
    2
    Been looking around and could not find much info on this, maybe you guys can help. I am attempting to make a very simple card builder in Unity. I want to be able to take some PNGs from a file and essentially layer them on top of an image or something and then put them together and export it out to a normal PNG making a card. Something like this http://www.hearthcards.net/. This is used to make hearthstone cards with set PNGs.
    Is there a way to make something like this in unity, and allow for the exporting of a PNG card file?

    Here you can make custom Hearthstone cards.
    I know this is a website but is something like this possible in Unity?

    First time posting, sorry if this was the wrong area. Thanks in advance!
     
  2. Bunny83

    Bunny83

    Joined:
    Oct 18, 2010
    Posts:
    3,572
    Yes, of course it's possible. Though the question is why you started this thread here. If all you wanted is hearing a yes or no, we can help you for future questions: It's almost always yes, sometimes it's just a matter of the amount of work you have to put into it.

    If you expect anything more detailed, you have to ask more detailed questions. Where are you stuck? What do you consider "very simple" because the page you linked has quite a few features so I wouldn't call it "very simply". What kind of features do you want / need? Don't expect answers to solve your problem(s) and provide code that solves those problems. Asking questions here should always be about finding knowledge and gaining new abilities as a developer. So questions like "Can I make FarCry / Doom / Crysis / Halflife / insert random game title here in Unity" the answer would always be: Sure, why not. It's all just a matter of your abilities and if you are willing to expand those.

    One of the most important skills is the ability to break down complex problems into smaller chunks that can be solved and understood easier.

    So it's not clear which parts you have doubts on. Unity can even create webGL builds, so you can actually make a website out of your Unity build. Just as an example, here's a parallel mandelbrot renderer I made years ago that runs in a browser and can export images as png or jpg.
    The linked spot after 10000 iterations
    Mandelbrot10k.png

    So yes, technically almost everything is possible.
     
  3. Nikewade

    Nikewade

    Joined:
    Sep 22, 2021
    Posts:
    2

    Thanks for the reply. I guess the "smaller chunk" question/questions would be, has anyone else done something like this in unity, and if so I wanted to find that to study it. I could not find anything sadly. And by this, I mean, a card generator, being able to edit and modify card decks/cards and export them into PNGs.

    The other question would be if there is nothing like this, where can I start? How would I go about taking multiple images, layering them on top of each other, and then merging them and exporting them into a PNG? During runtime, I would assume. Once I have the ability to do this, I am pretty sure I can finish everything else.
    When I mentioned the website bit that was just to cover ground, I know you can use WebGL to make a web-based program.

    In summary, I need to be able to create a system that allows you to take a base png (A picture of a base card), and then just pick and choose other PNGs to go into pre-determined spots on top of this PNG. And then take that finished card and the multiple layers of PNGs, merge them, and then export it into one PNG.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,954
    You can draw pixel by pixel but it's not very performant.

    You can write shaders or use textures and composite all kinds of things together with calls such as Graphics.Blit() or just using RenderTextures with normal cameras... you can really do anything you like.

    Here's a lottery scratcher thing I made:



    I actually don't recall how I did it but the entire package is linked in the comments.

    You can also build custom geometry easily in Unity. Here's a gaggle of random ways:

    MakeGeo is presently hosted at these locations:

    https://bitbucket.org/kurtdekker/makegeo

    https://github.com/kurtdekker/makegeo

    https://gitlab.com/kurtdekker/makegeo

    https://sourceforge.net/p/makegeo
     
    Bunny83 and Nikewade like this.
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,954
    Nikewade likes this.