Announcement

Collapse
No announcement yet.

Saving material

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Saving material

    can anyone give me some hints or help on how to save an objects material (in runtime would be great but not necessary). I’m having a large amount of meshes that I can click on to toggle between three different materials. I would like these changes to be saved so when you quit/relaunch the game your changes remain.

    kindly
    Fredrik

    #2
    Originally posted by Fiorentin1 View Post
    can anyone give me some hints or help on how to save an objects material (in runtime would be great but not necessary). I’m having a large amount of meshes that I can click on to toggle between three different materials. I would like these changes to be saved so when you quit/relaunch the game your changes remain.

    kindly
    Fredrik
    Obviously if it's not runtime then you can just save the level / mesh.

    At runtime, then you need to use a save game:

    https://www.youtube.com/watch?v=_4usRrTiqak
    Check out Zof ( puzzle game ) on Steam:

    https://store.steampowered.com/app/1414480/Zof/

    Comment


      #3
      Are you looking to save a material to a texture for performance reasons? Or just save a material configuration? If it's the latter, then SaveGame is the way to go as ClockworkOcean said.
      iTween For UE4
      Procedural pathed animation for actors, components & UMG - $0
      Runtime DataTable
      DataTables dynamically loaded from text or Google Sheets while your game is running!
      easyCSV
      Fast, cheap, and accurate CSV parsing at runtime!

      Comment


        #4
        Thank you Clockworkocean, ill watch it and see if I’m able to implement it!

        Jared, just saving the user configuration. It’s supposed to work as an aid for a 75y+ client with little computer experience. So getting it to save in runtime and limit the ui to as few options as possible is preferred.

        Lets see if I can implement something from that video..

        Comment


          #5
          Ok I think I get it but I don’t understand how to implement it on all the meshes. Do every mesh need a unique variable that communicates with a unique variable in save game blueprint? I’ve got about 500+ meshes that I want to toggle material on and save.

          Comment


            #6
            Originally posted by Fiorentin1 View Post
            Ok I think I get it but I don’t understand how to implement it on all the meshes. Do every mesh need a unique variable that communicates with a unique variable in save game blueprint? I’ve got about 500+ meshes that I want to toggle material on and save.
            It's a little hard to image what you have going there, maybe you can elaborate a bit, but...

            Yes, basically. Each mesh would need an ID, and you need to save the ID with the material you want to be known for that mesh.

            These IDs are something you invent yourself, it's not a system thing.

            If your meshes are blueprints, it's easy, just add an integer variable ( different for every BP ). When the user changes the material the BP writes it's ID to the save game together with the material used.

            If the meshes are just plain static meshes, bit more fiddly. You would need to so something like saving the level and object name and the material.

            Sounds like a bit of a pain, right? That's how it works I'm afraid.

            The other alternative, is to get a plugin to do it for you:

            https://www.unrealengine.com/marketp...save-extension
            Check out Zof ( puzzle game ) on Steam:

            https://store.steampowered.com/app/1414480/Zof/

            Comment


              #7
              Its really simple, nothing fancy but would be really useful. I'll attach images. Every dot represents a mesh, when "hit" it changes the material.
              Click image for larger version

Name:	click.jpg
Views:	102
Size:	119.6 KB
ID:	1804053

              Below the blueprint for the mesh that changes material
              Click image for larger version

Name:	click_blue2.jpg
Views:	37
Size:	422.6 KB
ID:	1804054

              Im actually trying thtat plugin right now but cant manage it to same my variable. I have followed the documentation but my variable "setmaterial" isnt saved.

              Had no idea this would be so hard to accomplish. All the graphics from 3ds max is supereasy to retrieve now with datasmith, i already have nice 360 renders but this is a pain like you said.
              Did a inventory based 2d game a couple of years ago in a 2d engine with lots of save functions and that was so easy compared to this.

              Since im on a deadline, do you know if there is a "marketplace" for getting this relative small project done by someone how knows what to do? Paid of course.

              Comment


                #8
                Originally posted by Fiorentin1 View Post
                Its really simple, nothing fancy but would be really useful. I'll attach images. Every dot represents a mesh, when "hit" it changes the material.
                Click image for larger version  Name:	click.jpg Views:	0 Size:	119.6 KB ID:	1804053

                Below the blueprint for the mesh that changes material
                Click image for larger version  Name:	click_blue2.jpg Views:	0 Size:	422.6 KB ID:	1804054

                Im actually trying thtat plugin right now but cant manage it to same my variable. I have followed the documentation but my variable "setmaterial" isnt saved.

                Had no idea this would be so hard to accomplish. All the graphics from 3ds max is supereasy to retrieve now with datasmith, i already have nice 360 renders but this is a pain like you said.
                Did a inventory based 2d game a couple of years ago in a 2d engine with lots of save functions and that was so easy compared to this.

                Since im on a deadline, do you know if there is a "marketplace" for getting this relative small project done by someone how knows what to do? Paid of course.
                Yes, so at least you have the material as a fixed int from an array. That's a good start.

                If all the BPs also had their own ID, then you have everything you need to do it with the default UE save game. You'd need a little bit of code to set the IDs, just get all actors of class and then set ID, but you'd need to do that in the level BP as an editor mode custom event. If you don't know about that it's probably quicker to get the plugin working, but I'm afraid I haven't used it.

                EDIT: Ok, I read the docs. You just mark the variables for saving.

                Then you need to use those blueprint nodes ( in the quick start ) to do the actual save and load. Did you do that?

                PS: Place to offer jobs is: https://forums.unrealengine.com/comm.../job-offerings
                Last edited by ClockworkOcean; 08-23-2020, 09:36 AM.
                Check out Zof ( puzzle game ) on Steam:

                https://store.steampowered.com/app/1414480/Zof/

                Comment


                  #9
                  Yes, i followed that short tutorial. Its marked for saving and the save and load is up and running. I also attached a print string in the bp above so im sure the variable is changing. I can see in the save folder that the.sav file is being updated wgen i save. But somehow the integer variable "set material" either wont save or load.

                  You'd need a little bit of code to set the IDs, just get all actors of class and then set ID, but you'd need to do that in the level BP as an editor mode custom event
                  Okay that would set Id's for me?

                  Comment


                    #10
                    Originally posted by Fiorentin1 View Post
                    Yes, i followed that short tutorial. Its marked for saving and the save and load is up and running. I also attached a print string in the bp above so im sure the variable is changing. I can see in the save folder that the.sav file is being updated wgen i save. But somehow the integer variable "set material" either wont save or load.

                    You'd need a little bit of code to set the IDs, just get all actors of class and then set ID, but you'd need to do that in the level BP as an editor mode custom event
                    Okay that would set Id's for me?
                    I was looking at your code. I think the shapes are loading their color before the save game has had a chance to load.

                    I assume you're doing the savegame stuff in the level BP?

                    Then you need to edit the shape BP, so there's a delay before loading the color on begin play.
                    Check out Zof ( puzzle game ) on Steam:

                    https://store.steampowered.com/app/1414480/Zof/

                    Comment


                      #11
                      Ok i tried that, up to 2 sec delay but still no successful save/load. I can see that the game loads or resets something since the clouds in the background jump to another position. No idea why it wont work and the save plugin has very little information.

                      Yes the savegame stuff is in the level BP.

                      Comment


                        #12
                        After reading comments on the marketplace site and their github it seems like the SaveExtension plugin has some problems. Several has the same issues as me. Hopefully they will comment or fix this, in the meantime i will have to do it manually or look for another plugin.

                        Comment


                          #13
                          Originally posted by Fiorentin1 View Post
                          After reading comments on the marketplace site and their github it seems like the SaveExtension plugin has some problems. Several has the same issues as me. Hopefully they will comment or fix this, in the meantime i will have to do it manually or look for another plugin.
                          Bummer.

                          If you quote me I get a notifcation, otherwise it's pure chance that I see this...

                          So, with a UE savegame. Do this:

                          Somewhere very early on, only once ( ever ):

                          Click image for larger version  Name:	make SG.JPG Views:	0 Size:	74.8 KB ID:	1804140

                          Then inside your BP, to save color:

                          Click image for larger version

Name:	image_201109.jpg
Views:	52
Size:	126.9 KB
ID:	1804141

                          and to load color:

                          Click image for larger version  Name:	load col.JPG Views:	0 Size:	124.4 KB ID:	1804142
                          Check out Zof ( puzzle game ) on Steam:

                          https://store.steampowered.com/app/1414480/Zof/

                          Comment


                            #14
                            ClockworkOcean thanks, I’ll look into it as soon as I’m back at the computer.

                            just a short one; would it be easier to use a destroy/spawn actor(mesh with other material) instead of set material setup? In regards of saving/loading all these meshes.

                            Comment


                              #15
                              Originally posted by Fiorentin1 View Post
                              ClockworkOcean thanks, I’ll look into it as soon as I’m back at the computer.

                              just a short one; would it be easier to use a destroy/spawn actor(mesh with other material) instead of set material setup? In regards of saving/loading all these meshes.
                              It's worse. Just changing the material is easier, at least you don't have to spawn them also

                              Check out that stuff I gave you, if you can't get it working, come back.

                              Also, if you project isn't too massive, maybe I can download it from somewhere and take a look...
                              Check out Zof ( puzzle game ) on Steam:

                              https://store.steampowered.com/app/1414480/Zof/

                              Comment

                              Working...
                              X