[Unity 5] Tutorial: Save And Load system - How to save unity stuff in one file part #2

preview_player
Показать описание
Hello guys and welcome to another unity 5 tutorial!
In this tutorial we are going to make e a Save And Load system

I hope you guys like it!

Also if you got any questions, just ask in the comments!

----------------------------------------

Comment Rate and Subscribe

----------------------------------------

Daily
├ instagram (almost every day):
├ Twitter (few times a week):
├ Facebook (few times a week):
├ Google+ (few times a week):
├Youtube (twice a week)
├Indiedb (once a week):

monthly
Рекомендации по теме
Комментарии
Автор

When you finish with the video, you'll most likely have an error in the Load() Function, after the naming convention(the string). It should

bryancox
Автор

I got this error:

Assets/Scene/Scripts/SaveSystem.cs(74, 36): error CS1502: The best overloaded method match for `System.IO.File.Open(string, System.IO.FileMode)' has some invalid arguments


Assets/Scene/Scripts/SaveSystem.cs(74, 91): error CS1503: Argument `#2' cannot convert `method group' expression to type `System.IO.FileMode'


Void:

public void Load()
{
if + "saves/SaveData.dat"))
{
BinaryFormatter bf = new BinaryFormatter();
FileStream file = + "saves/SaveData.dat", File.Open);
data =

CopyLoadData();

file.Close();


}
}

GhosthyGamer
Автор

Im getting some errors :(

Error 01:
SerializationException: serializationStream supports seeking, but its length is 0
(System.IO.Stream serializationStream, handler) (at
(System.IO.Stream serializationStream) (at
SaveLoad.Load () (at
GameManager.Start () (at


Error 02:
InvalidCastException: Cannot cast from source type to destination type.
SaveLoad.Load () (at
GameManager.Start () (at
Line in question:
gameManager.saveData =



SetharofEdgarDead-Rose
Автор

SerializationException: serializationStream supports seeking, but its length is 0
(System.IO.Stream serializationStream, handler) (at
(System.IO.Stream serializationStream) (at
SaveAndLoad.Load () (at
SaveAndLoad.Start () (at

RemiG-D-Art
Автор

I am from the Czech Republic but - like it

tomasfriedl
Автор

Thank you for uploading these videos! But I got this error at line 63, where ' FileStream file = + "/saves/SaveData.dat", File.Open); '

CS1503 Argument 2: cannot convert from 'method group' to 'FileMode' Assembly-CSharp

Any ideas? I must have missed something, right?

iangraham
Автор

Thank you, this is really helpful! just if you can add some thing in the editor to demonstrate how its going through it would be much better ;3

blahbalksjjajjjdj
Автор

Hi Gamad this script will save the position and current game state? For example, if i pickup a key in my game and i hit save will save my last position and the key i picked up?

I'm learning how to code little by little on my own and Saving/Loading has been a nightmare for me to figure out.

IMLOGIC
Автор

You didn't explain how to set up the script in the editor. Anyone know how to get this working? Or did I just waste an hour copying code only to delete it?

SoggySocksGames
Автор

In public void Load()

FileStream file = + "/saves/SaveData.dat", File.Open);

The line above has an error.

Argument 2: cannot convert from 'method group' to 'FileMode'


Is it supposed to be this?

FileStream file = + "/saves/SaveData.dat", FileMode.Open);

Also where does this file get saved to? I can't see it anywhere.

dredgeho
Автор

:D Oh, I wanted to thank. I dont need help now. It was a misunderstanding . It was my fault. Sorry for my English. Thank for all.

tomasfriedl
visit shbcf.ru