When you’re ready to load, getting the saved value is just as easy: PlayerPrefs.SetInt("Level", currentLevel) currentLevel is an integer variable representing the level the player is on All you need to do to save the level is the following: Well, this looks pretty easy in PlayerPrefs. You’ve decided you want to save the level your player is on when they quit the game so that the correct level loads back up when they start again. Let’s say you’ve made a simple game with some number of levels. With PlayerPrefs, you can have an easy-to-use interface that allows you to start persisting some data! We’ll also discuss reasonable alternatives to using PlayerPrefs. In this article, we’ll go over what PlayerPrefs is, how, when, and when not to use it. The simplest solution is a Unity class called PlayerPrefs. ![]() From this search, you may be surprised that there are quite a few different answers, all varying in complexity. If you’re like most of us, your first instinct might be to do a quick search on how to save player data in Unity. Whether you’re relatively new to developing in Unity or you’ve got a few projects under your belt, you’ve most likely realized how useful it would be for players to save data. Why you should (or shouldn’t) save data with Unity’s PlayerPrefs But with a giant Ship its easy to build 2 or 3 Canteens……or 20.Brian Drake Follow Brian is the owner of UpRoom Games, a small independent game studio focused on creating unique experiences and sharing game dev knowledge in Unity. What does a larger ship mean, exactly also a higher consumption, so it`s the best to create a save game with a galaxy that offers a lot of resources that makes it easier and often even possible to maintain a large or gigant ship.Ī common problem with large ships is that the crew has to travel extremely long distances, even if you have enough resources, problems can arise because the crew has to travel long distances to take care of certain things, and I have often had the crew members almost starve even though I have enough food, mainly because by the time the crew members get to the canteen, the break is over and they go to bed without eating. If the ship grid is too large, problems can arise. My personal recommendation is not to make the building grid too big, sx=”84″ sy=”140″ is sufficient, keep in mind that asteroids and wrecks are always placed in such a way that the ship definitely fits into a system each time it enters. ![]() That’s all, now save the file and start the game, now you should have a bigger grid and you can build the ship of your dreams. Here you put exactly the same numbers in the “sx=” and “sy=” areas you puted in the line with the Ship name! Just make sure once you find it, its still within the same savegame entry and you haven’t scrolled into the next ship section.Ī simple method is to press SHIFT+F again and click the search direction down, then just search “Roof”, it will show the first best result and that is pretty much always the line that still belongs to that ship. This part of savegame is harder to find and requires a bit of focus. ![]() ![]() If dimensions in ship’s header and roof will mismatch, you may not be able to build subsystem in some parts of the ship. The next place you need to edit is the ship’s “roof” area for systems. You can also make it bigger but this can bring problems, more about that i write in “Gameplay recommendations” Personally, I always give sx=”84″ sy=”140″, this size is perfect and is the size that you could already see at the beginning, you can of course also swap the numbers to sx=”140″ sy=”84″ then you have a wide ship Which numbers must now be given there? Well, a grid has 28×28 squares, which means that you have to add +28 for each grid, i.e.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |