Save And Load If An Actor Is Destroyed - Unreal Engine 4 Tutorial

Поделиться
HTML-код
  • Опубликовано: 20 янв 2025

Комментарии • 109

  • @umbakarnask3844
    @umbakarnask3844 3 года назад +2

    This seems like something that I have been looking for but I will need to analyse it later. For a tutorial regarding such important topic this video would deserve more views.

  • @GaryParkin
    @GaryParkin 2 года назад +5

    Thanks Matt. This was just what I was doing this week. I'm sure you know this but at 20:42, you cannot use the name of the block, well... you can't use the Display Name but you can use the Object Name. They are the same in the editor but it doesn't work after compiled (per the forums). (No idea why, but the docs say not to use the display name).
    I'm messing with a kind of city building game so I fixed this by creating a variable of type GUID in the block and then passing a GUID to my block when I created it, using New GUID, since I was creating them on the fly. And that worked.
    I saved the GUID in the block because it's guaranteed to be unique. C++ users have a MakeUniqueObjectName but Blueprints do not.
    My issue currently is working out how to save all of the different block's data. For now I created arrays in the SaveGame object.

  • @megtwin
    @megtwin 3 года назад +2

    So happy to find this, thanks for making this tutorial and all the others you have made!

  • @notaaroniswear
    @notaaroniswear Год назад +3

    Thank you for the great video. I can confirm this is still 99% the same for unreal engine 5.3; as one user mentioned below instead of manually assigning a variable with a name of the object, you can call ``call reference to self>get object name`` and put the return value into the Name return pin (and create the auto-changer between string and name).
    The save process can be easily applied to widgets, which is what I needed (the widgets' "event begin play" has the name "event construct" instead).
    Thank you.

    • @tobysmithgame
      @tobysmithgame Месяц назад

      This works fine for 1 level but across multiple levels, game objects like coins can have the same name. There fore if you pick up "Coin1" in level 1 it also deletes "Coin1" in level 2.
      Try using "GetObjectPathString", this works the same but also across different levels.

  • @not_vdb0059
    @not_vdb0059 3 года назад +4

    it doesn't work for me : ( how can i fix this?

  • @studiobaxter1242
    @studiobaxter1242 Год назад

    Much later with a bigger game, yes indeed the delay did need to be increased, which worked. Thanks again.

  • @JoseManuelRodenes
    @JoseManuelRodenes 3 года назад +2

    The first thing to thank you very much for your tutorials, tell you that it works for me and not at the same time hehehe, I explain, I already had a system to save health and mana (in the player interface), amount of coins collected (in the interface the player), number of keys collected (in the interface the player), my system saved and loaded this data well, the problem I had is that, when I collected for example a coin, in the interface it reflected it well but the currency when loading the game It reappeared and of course your video was just what I needed.
    Of course I do not have the same configuration as you in the video, for example I save and load from the menu pause / Save-Load and the CustomEvent save load I have it in the gameinstance not the PlayercontrollerBP (MyPlayerController BP in your video), this is where it happens to me that if:
    I give it play game from level 1 for example, I pick up an item, I go out and load, the item and this is not there, it works perfect, but if I hit the menu and give it a new game and load from the menu pause / Save-Load the Items are back hehehe, total madness hahaha.
    My question is all the custom event that you put in MyPlayerController (save - load), can I put it in my game instance and thus make a hybrid between what I have and what you explain in the video?
    I would understand that you think I'm totally crazy hahaha.
    Sorry for my language as I do not know English and I am a translator.
    Greetings and thank you, even if you do not answer this bible :)

  • @GrumpyMunkyGameDesign
    @GrumpyMunkyGameDesign 3 года назад +10

    Tidbit: Theres a 'Delete Save in Slot' Node you can use. Also, yes Unqiuely identify name help would be great, i got thousands of em to track!🤣🤣
    Edit: Nevermind, Figured it out! Instead of using a Variable in the Pickup (Actor ID) Do get object name > Self > Convert string to name, and plug that in to the destroy and check nodes as the ID instead. Just for anyone who wanted to know, seems to work for me so far over my 5 mins or so of testing it

    • @minilabyrinth
      @minilabyrinth 2 года назад +3

      You're the GOAT dude. I was about to have to manually adjust the ID name of 600 different hand-placed collectibles in my game

    • @GrumpyMunkyGameDesign
      @GrumpyMunkyGameDesign 2 года назад

      @@minilabyrinth Glad my little comment helped someone!

    • @pi3tiaa
      @pi3tiaa 2 года назад +1

      Can you show how it's look like? I'm doing it but nothing works. Destroyed Actors Array is showing exact objects name so i am doing it properly but items are not destroyed. If i do it like in this video, Actor id is other than what I wrote (print string after call destroy item function in pickup event)

    • @ManthosLappas
      @ManthosLappas 2 года назад

      Hello there! Im sorry but, could you please help us understand by somehow showcase how this is done? (lacking the understanding of how to convert and whatnot, or the rest of the process.) Thank you in advance!
      Edit: Might Have done it (not entirely sure) however while it works in PIE, destroyed actors are not saved when building/ packaging the game. Any of you guys have any ideas?

    • @GrumpyMunkyGameDesign
      @GrumpyMunkyGameDesign 11 месяцев назад +1

      @@ManthosLappas how are you pulling the name? I use 'reference to self > drag off and type to 'string' you should get a node with two coloured dots, the pink being the string > drag off string pin and type 'to name' this should give you another two nodes this time pink to purple, then plug the name into the add to array and done, dont use the 'get object name' node, seemed to cause me issues, also when looking up the item on begin play, when searching if the actor is in the arrayi found 'contains' more reliable thn 'find actor in array, > 0' method in the video, maybe these can help you out, i actualy came back to this comment to redo the save system for myew game and found my own comment to help me lol, it works perfectly in my game, havent tested a build project yet but im just about too so il update in a bit
      Also some names might not be unique ie same actor name could appear in another level so u can either save to a slot using the level name as slot and only load the array for that level, or add a level prefix to the item name ie 'Lvl_1_Door_1' that way if theres a Door_1 in level two as well, when level two is loaded it wont delete that acto, only the version in the appropriate level
      might do a video on this to be fair, could be more helpful than a wall of text

  • @chrishill3dartist961
    @chrishill3dartist961 Год назад

    Best tutorial ive found regarding level states!

  • @mysticprophecyroblox
    @mysticprophecyroblox 4 месяца назад +1

    Nicee, can confirm that this works on UE5.4.3. I nearly commented saying it wasn't working but I was missing a pin. To anyone struggling, I recommend playing game in new editor window, open each script and changing debug object to whatever it's using and looking at the script execution lines to see if they go far enough. Having a load hotkey button is handy for that too

    • @tobysmithgame
      @tobysmithgame Месяц назад

      Haha I remember struggling to get a simple moving platformer to work for nearly 5 hours after watching a tutorial. I forgot to tick a box, that was it lol.

  • @saskialange4257
    @saskialange4257 Месяц назад

    i'm interested in knowing what the drawback would be to saving the destroyed actors array directly to the save game instead of to the instance and then updating it in the insatance?

  • @Mark_Play_Tipo
    @Mark_Play_Tipo 3 месяца назад

    hello! when i saving game error says: Blueprint Runtime Error: "Attempted to assign to None". Blueprint: myplayercontroller Function: Execute Ubergraph Myplayercontroller Graph: EventGraph Node: Set DestroyedActors

    • @tobysmithgame
      @tobysmithgame Месяц назад +1

      Try setting the "SetDestroyedActors" to public that worked for me.

  • @iGameDesign
    @iGameDesign 7 месяцев назад

    Thank you! Its so greate to find a realy good video about Save Actors!

  • @darkestdaysvideogame
    @darkestdaysvideogame 7 месяцев назад

    Any particular reason to save inside controller instead of game instance? Nevermind, this won't work for me, since I have pickupable items that are spawning in the world.

  • @Othman1992on
    @Othman1992on 3 года назад +3

    Could you please make a tutorial on how to create a spawn animation for the character everytime it dies? i.e. teleporing in, scanning in, etc.

  • @arigura2803
    @arigura2803 Год назад

    finally I was able to do it, I tried many times in total spent about 10 hours on it ... I don’t understand why it worked after your video the first time ...

  • @RiveroGames
    @RiveroGames Год назад +2

    Unlikely I'll get a response, but how would one go about doing this over multiple maps? I'm struggling to keep track of ID numbers and would prefer each level starts with an ID of 0 rather than 0,2,4 in firstmap and 1, 3, 5 in secondmap. I could of course reorder things but once there's so many id's it's difficult to keep track and reorder so many. I have a working method where an additional variable checks what level to look in, but this adds another variable and was hoping I could do it in a way that only requires one. Say, making just a single string that has the integer and map name and then split it. (Even this feels inefficient though)

    • @tobysmithgame
      @tobysmithgame Месяц назад

      Use: Self> GetObjectPathString and plug that into ItemID instead of the ActorID.

  • @Brodison
    @Brodison 3 месяца назад

    6:46 I'm adding this as a reminder to future me to change delay since my game will take longer to load late

  • @megtwin
    @megtwin 3 года назад +2

    Hey could you show how to automagically assign an ID to the items? I need this because the player has an option to drop an item and if it does I need a way to assign it a new ID. EDITED: I got the auto assigning an ID worked out but player drops the item from inventory it auto disappears. Is there a way to assign it a new ID?

    • @magicool27
      @magicool27 2 года назад

      Did you find a solution? I have the same problem right now

    • @megtwin
      @megtwin 2 года назад

      @@magicool27 Unfortunately not yet. But if I find one I'll post it here.

    • @tobysmithgame
      @tobysmithgame Месяц назад

      Self>GetObjectPathString effectively assigns a unique id for each object and works over different levels.

    • @megtwin
      @megtwin Месяц назад +1

      @@tobysmithgame I figured it out awhile back but thanks!!

  • @misterrider19
    @misterrider19 3 года назад +2

    Such a useful tutorial, thanks a lot !

  • @KGCofficial7
    @KGCofficial7 3 года назад

    Do you know how to access the nav mesh bounds, because I'm on macbook pro and I don't know how.
    The area that has the nav mesh bounds?

  • @charan3278
    @charan3278 3 года назад +6

    Can you make a tutorial how to equip and drop guns please . BTW good explanation

  • @stevenwynn819
    @stevenwynn819 3 года назад

    Super useful! Well explained too.

    • @MattAspland
      @MattAspland  3 года назад

      Thanks Steve! Happy to hear it :)

  • @kimjong9
    @kimjong9 2 года назад

    does it affect to save and load or checkpoint game?

  • @slymncag
    @slymncag 2 года назад

    When I log out of the game to the desktop and after logging in, objects are not deleted but when I load 2 times in a row, it works properly. What is the problem?

    • @slymncag
      @slymncag 2 года назад +1

      This happens on different levels as well because I have the same problem when I go to the main menu and click the load button.does anyone have any ideas?

  • @krasnavin
    @krasnavin 10 месяцев назад

    Updates to UE5.3?

  • @Emarketsarts
    @Emarketsarts 2 года назад

    Doesn't work for me so far , though i am trying this in SGKv2 as a base project.

  • @thesdadhanneldsadas
    @thesdadhanneldsadas 3 года назад

    Everything is working, but its not connected when you want to start new game, when you press new game and you want to start the game from beginning the actor is still destroyed, how can i fix this ? Since it is not mention in tutorial :) May you please tell me ? :)

    • @megtwin
      @megtwin 3 года назад +2

      If you start the game from the beginning you need to delete the save slot first.

    • @ManthosLappas
      @ManthosLappas 2 года назад

      @@megtwin Hi there! having the same problem here, added a "Delete Game in Slot"(for new game function) but still the same problem-actors are destroyed unless the game is manually quit to desktop completely and restarted again. Any ideas? Thank you for your time.

    • @megtwin
      @megtwin 2 года назад +1

      @@ManthosLappas Hi there. Sorry, I have not figured out how to actually delete the saved slot from within the editor.

    • @ManthosLappas
      @ManthosLappas 2 года назад +1

      @@megtwin hello there, no worries, it's kinda been frustrating that it only works after the game has been shut down and re opened. Guess will look around more into it. I appreciate your reply regardless! :)

    • @megtwin
      @megtwin 2 года назад +1

      @@ManthosLappas If you find anything out, please let me know.

  • @r0b3rt404
    @r0b3rt404 Год назад

    Sadly after I Packaged the game the actors just didn't spawn. Any fix for this issue? (it's the only thing that don't work in my game xD)

  • @C1ayz
    @C1ayz 3 года назад

    i have a mesh and i want to put on it claws and eyes how?

    • @MattAspland
      @MattAspland  3 года назад

      Hey mate, if you have the claws and eyes, you could maybe make a blueprint and place them all inside together, or if not, you could open the mesh in Blender and create claws and eyes onto it

    • @C1ayz
      @C1ayz 3 года назад

      @@MattAspland 🙏 thx

    • @prostar5862
      @prostar5862 3 года назад

      @@MattAspland i want the same thing but what bluprint should i use

    • @MattAspland
      @MattAspland  3 года назад

      @@prostar5862 Hey mate, a blueprint actor should work great

    • @prostar5862
      @prostar5862 3 года назад +1

      @@MattAspland ok iplaced them all togther now how to let them not moving like i can pull it

  • @ManthosLappas
    @ManthosLappas 2 года назад +1

    Hello Matt, and everyone. Wonderful video, just like always, Thank you for making this as well the rest of your content. I would like to ask about a problem that occurs. Creating a new game option-by using the "delete save in slot" command before opening level results starting a game where destroyed actors remain so.
    It is only when the game is completely shut down/quit to desktop that seems to initiate a new game with the destroyed actors properly restored. However, This doesnt seem to work when the game is open and wish to go from in-game or game menu to main menu and do "new game".
    In addition-Update: The video solution seems to not work when building /packing the game. Its only in the PIE that actors do remain destroyed after loading.
    Any suggestions for possible fixes? Thank you again.

    • @akif_akdemir
      @akif_akdemir 10 месяцев назад

      The solution to this is to call the load game event with get game instance after begin play within the character or level bp.

  • @Pixellions
    @Pixellions 3 года назад +1

    Hey, very usefull video, thanks. If you have a good method to automatically assign a unique ID to an item or pawn when they get dragged (or spawned) to the scene I would be very interested!

    • @klausvogler6710
      @klausvogler6710 2 года назад

      A bit late, but out of the blue I woul use the actor name in combination with the world location. Very unlikely that two actors share the same origin. And if they do, they will have different names^^

    • @Pixellions
      @Pixellions 2 года назад

      @@klausvogler6710 Yes I guess it's not a bad way thanks!

  • @Emarketsarts
    @Emarketsarts 2 года назад

    Is there a way of adding to this to save and load AI spawn transform , to save and load AI location ?

    • @studiobaxter1242
      @studiobaxter1242 Год назад

      I've been trying for days and buggered if I can get it to work. Did you?
      Also my large save game function already existed in my character blueprint whereas Matt does it in the player controller. Don't know if this is messing it up. I'm not getting any error messages, it's just not doing anything, all AI respawns as normal.

    • @ManthosLappas
      @ManthosLappas Год назад

      @@studiobaxter1242 Hi there, I am doing the same thing as you do, while no errors it only works in pie, but not in packaged game. No idea why.

    • @studiobaxter1242
      @studiobaxter1242 Год назад +1

      @@ManthosLappas
      I don't know enough to know why it only works in editor mode, but I did get mine to work eventually and it also
      works in Standalone mode. I can look into it a bit and tell you what I did, if you can't work it out.

    • @ManthosLappas
      @ManthosLappas Год назад

      @@studiobaxter1242 Thank you kindly for your reply. I managed to get it working on standalone, but unfortunately, not in a packaged game which is the most important. I would be interested to get an opinion on the latter or suggestions if that is not a trouble. Appreciated!

    • @studiobaxter1242
      @studiobaxter1242 Год назад +1

      @@ManthosLappas
      Sorry, as to why it doesn't work when packaged is out of my league. I'm not even up to packaging a game yet.

  • @lvcass3258
    @lvcass3258 Год назад

    usefull tutorial. thanks! but if u have inventory item and drop item function, once u save the destroy actor, the id will stick. and when u reload and drop the item, it will destroyed.

  • @gamerdweebentertainment1616
    @gamerdweebentertainment1616 3 года назад +1

    So... next up save the character??? Save files? Etc? :)

    • @MattAspland
      @MattAspland  3 года назад +1

      Hey mate, I have a few on saving and loading, let me know if they are of any help to you :)
      ruclips.net/p/PLQN3U_-lMANPXaQuK_e_AtRBTlKfH4Qih

  • @VelikyUkr
    @VelikyUkr Год назад

    Bro, your my god ❤

  • @carloscj2494
    @carloscj2494 2 года назад +2

    Waste of time, I did it literally as in the tutorial and I never save anything

  • @MeowMasterZombo
    @MeowMasterZombo 2 месяца назад

    Didn't work for me anymore :(

  • @abdullahsohail5395
    @abdullahsohail5395 3 года назад

    Nice video 😊

  • @fastxplay
    @fastxplay 3 года назад

    thanks matt you did for me

  • @Emarketsarts
    @Emarketsarts 2 года назад

    Yea , got it working , thanks

  • @artdrawing6682
    @artdrawing6682 5 месяцев назад

    thanx matt

  • @DarxDev
    @DarxDev 3 года назад

    a better method is to serialize the actor and use the GUID, then spawn with the correct class and transform and stuff

  • @turbolol-0
    @turbolol-0 2 года назад +2

    Tip: Use OBJECT NAME instead of an unique variable...

    • @ManthosLappas
      @ManthosLappas 2 года назад

      Hi there, can you please explain where exactly do you change that into object name and how? (not sure what command to insert/replace and where into) Thank you in advance!

    • @turbolol-0
      @turbolol-0 2 года назад +1

      @@ManthosLappas Havent used Unreal in a while, but I think there's a node called
      'Object Name'. You can't change it's value but it is unique.

    • @ManthosLappas
      @ManthosLappas 2 года назад

      @@turbolol-0 Hello there, Thank you kindly for your quick reply, I do appreicate that. Yes, I believe I havefigured that out. It seems to work but sadly, actors are not saved when playing the built/packaged game so thats something to investigate. Cheers!

    • @turbolol-0
      @turbolol-0 2 года назад +1

      @@ManthosLappas You got it, hopefully you'll figure it out!

    • @ManthosLappas
      @ManthosLappas 2 года назад

      @@turbolol-0 Thank you!

  • @BhaktiiKiShaktii
    @BhaktiiKiShaktii 3 года назад

    Nice lacture

  • @nand-studios
    @nand-studios 11 месяцев назад

    gg