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

  Рет қаралды 14,906

Matt Aspland

Matt Aspland

Күн бұрын

Пікірлер
@GaryParkin
@GaryParkin 2 жыл бұрын
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.
@umbakarnask3844
@umbakarnask3844 3 жыл бұрын
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.
@mysticprophecyroblox
@mysticprophecyroblox 3 ай бұрын
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.
@notaaroniswear
@notaaroniswear Жыл бұрын
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.
@GrumpyMunkyGameDesign
@GrumpyMunkyGameDesign 3 жыл бұрын
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 жыл бұрын
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 жыл бұрын
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 10 ай бұрын
@@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
@studiobaxter1242
@studiobaxter1242 Жыл бұрын
Much later with a bigger game, yes indeed the delay did need to be increased, which worked. Thanks again.
@not_vdb0059
@not_vdb0059 3 жыл бұрын
it doesn't work for me : ( how can i fix this?
@JoseManuelRodenes
@JoseManuelRodenes 3 жыл бұрын
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 :)
@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 ...
@Othman1992on
@Othman1992on 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.
@galaxyofinfotainment
@galaxyofinfotainment 3 жыл бұрын
Yes i am also waiting for it
@Othman1992on
@Othman1992on 3 жыл бұрын
@@galaxyofinfotainment thumbs up so he can see it.
@galaxyofinfotainment
@galaxyofinfotainment 3 жыл бұрын
@@Othman1992on already did✨😀
@aidanhester5807
@aidanhester5807 2 ай бұрын
6:46 I'm adding this as a reminder to future me to change delay since my game will take longer to load late
@saskialange4257
@saskialange4257 28 күн бұрын
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?
@chrishill3dartist961
@chrishill3dartist961 Жыл бұрын
Best tutorial ive found regarding level states!
@megtwin
@megtwin 3 жыл бұрын
So happy to find this, thanks for making this tutorial and all the others you have made!
@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.
@charan3278
@charan3278 3 жыл бұрын
Can you make a tutorial how to equip and drop guns please . BTW good explanation
@galaxyofinfotainment
@galaxyofinfotainment 3 жыл бұрын
Yes please
@gamerdweebentertainment1616
@gamerdweebentertainment1616 3 жыл бұрын
depends on the end system :) kzbin.info/www/bejne/mGe7c619jNSYZqs&ab_channel=Beardgames simple one...
@MattAspland
@MattAspland 3 жыл бұрын
Hey, I can add that to my list yeah, and thank you :)
@charan3278
@charan3278 3 жыл бұрын
@@MattAspland thank u
@galaxyofinfotainment
@galaxyofinfotainment 3 жыл бұрын
@@MattAspland thanks bro
@megtwin
@megtwin 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 Ай бұрын
@@tobysmithgame I figured it out awhile back but thanks!!
@RiveroGames
@RiveroGames Жыл бұрын
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.
@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?
@iGameDesign
@iGameDesign 6 ай бұрын
Thank you! Its so greate to find a realy good video about Save Actors!
@Mark_Play_Tipo
@Mark_Play_Tipo 2 ай бұрын
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 Ай бұрын
Try setting the "SetDestroyedActors" to public that worked for me.
@kimjong9
@kimjong9 2 жыл бұрын
does it affect to save and load or checkpoint game?
@misterrider19
@misterrider19 3 жыл бұрын
Such a useful tutorial, thanks a lot !
@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.
@studiobaxter1242
@studiobaxter1242 Жыл бұрын
Do you know a solution?
@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 жыл бұрын
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?
@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)
@krasnavin
@krasnavin 9 ай бұрын
Updates to UE5.3?
@Pixellions
@Pixellions 3 жыл бұрын
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 жыл бұрын
Doesn't work for me so far , though i am trying this in SGKv2 as a base project.
@gamerdweebentertainment1616
@gamerdweebentertainment1616 3 жыл бұрын
So... next up save the character??? Save files? Etc? :)
@MattAspland
@MattAspland 3 жыл бұрын
Hey mate, I have a few on saving and loading, let me know if they are of any help to you :) kzbin.info/aero/PLQN3U_-lMANPXaQuK_e_AtRBTlKfH4Qih
@ManthosLappas
@ManthosLappas 2 жыл бұрын
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 9 ай бұрын
The solution to this is to call the load game event with get game instance after begin play within the character or level bp.
@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 Жыл бұрын
@@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 Жыл бұрын
@@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.
@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 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 жыл бұрын
@@ManthosLappas Hi there. Sorry, I have not figured out how to actually delete the saved slot from within the editor.
@ManthosLappas
@ManthosLappas 2 жыл бұрын
@@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 жыл бұрын
@@ManthosLappas If you find anything out, please let me know.
@stevenwynn819
@stevenwynn819 3 жыл бұрын
Super useful! Well explained too.
@MattAspland
@MattAspland 3 жыл бұрын
Thanks Steve! Happy to hear it :)
@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 жыл бұрын
@@MattAspland ok iplaced them all togther now how to let them not moving like i can pull it
@carloscj2494
@carloscj2494 2 жыл бұрын
Waste of time, I did it literally as in the tutorial and I never save anything
@theoryguides
@theoryguides 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!
@theoryguides
@theoryguides 2 жыл бұрын
@@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 жыл бұрын
@@theoryguides 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!
@theoryguides
@theoryguides 2 жыл бұрын
@@ManthosLappas You got it, hopefully you'll figure it out!
@ManthosLappas
@ManthosLappas 2 жыл бұрын
@@theoryguides Thank you!
@VelikyUkr
@VelikyUkr Жыл бұрын
Bro, your my god ❤
@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
@MeowMasterZombo
@MeowMasterZombo Ай бұрын
Didn't work for me anymore :(
@Emarketsarts
@Emarketsarts 2 жыл бұрын
Yea , got it working , thanks
@abdullahsohail5395
@abdullahsohail5395 3 жыл бұрын
Nice video 😊
@MattAspland
@MattAspland 3 жыл бұрын
Thanks a lot bro! :)
@fastxplay
@fastxplay 3 жыл бұрын
thanks matt you did for me
@artdrawing6682
@artdrawing6682 5 ай бұрын
thanx matt
@BhaktiiKiShaktii
@BhaktiiKiShaktii 3 жыл бұрын
Nice lacture
@MattAspland
@MattAspland 3 жыл бұрын
Cheers bro :)
@nand-studios
@nand-studios 10 ай бұрын
gg
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.
Save And Load Player Stats - Unreal Engine Tutorial
12:46
Matt Aspland
Рет қаралды 41 М.
Save And Load Player Level And EXP - Unreal Engine Tutorial
10:43
Unreal Engine 4 Tutorial - Saving Level States
26:39
Ryan Laley
Рет қаралды 28 М.
How To Hide In A Locker - Unreal Engine 4 Tutorial
26:43
Matt Aspland
Рет қаралды 32 М.
How To Open A Locked Door With A Key - Unreal Engine 4 Tutorial
14:58
Destructible Mesh (Any Mesh) - Unreal Engine 4 Tutorial
7:58
Matt Aspland
Рет қаралды 105 М.
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН