This question already has answers here:
What is the best way to save game state?
(2 answers)
Closed 5 years ago.
Im making a game in unity and need a leader board that displays highscores and the name they provide at the end of the game.
How do I save these and keep them for later use (even after closing and reopening the game) and then apply them to a leaderboard.
Assuming the people who play are on different computers you'll need to persist the high score data on a machine somewhere. (If they're not on different computers you could just store it in a text file locally on that single machine.) A good choice for persisting would be a database. You'll probably want to secure the database so that people don't mess with it so you may need a web or HTTP front-end that your Unity app interfaces with. You can use WWW in Unity to call your front-end.
Related
This question already has answers here:
Save and load entire scene in Unity
(3 answers)
Closed last year.
I am making a game where you can build stuff while playing, im trying to figure out how to save a entire scene and load it, like with a json file or saving data of blocks placed in a array with playerprefs. thanks
You ideally want to place all of the data you are looking to save into a struct, then save via JSON. You can then read the JSON and then reinstate what was build previously.
This question already has answers here:
Need a JSON parser for Unity3d
(2 answers)
Serialize and Deserialize Json and Json Array in Unity
(9 answers)
Closed 5 years ago.
I'm building a game and I need to store multiple data about levels:
A list of strings for dialogs
An int for the countdown time of each level
A float for right answer
Strings for dynamically loaded asset names.
probably some other data..
Coming from a web background, the most obvious path is to make this with JSON, but Unity 3D does not provide JSON support out of the box.. so I thought of XML, but still, no native support.. then I thought about multidimentional array, but there are limitations, such as the data types must be the same.
As a student, I want to do things according to the development pattern of the engine without external libraries, and my question is How do Unity Game Developers store data like this? What is the best way to deal with this problem?
This question already has answers here:
How to make a window always stay on top in .Net?
(14 answers)
Closed 8 years ago.
I googled some sites but can't find. I want to keep form on fullscreen game. I make gametool software and that feature is important. I need *VB.NET or C# example for this.
Thank you!
NOT: I saw that topic:How to make a window always stay on top in .Net?. Bu the answer not work on games.
You need to HOOK into the game so you can render with the game (this is a pretty huge topic), unless the game is windowed, in that case you can just force the form to be the top window (Like the link in one of your comments explains).
Beware that this is considered an hack by most anti-cheat software (as it should..).
Things such as Steam are whiteflagged.
This question already has answers here:
How can I create a product key for my C# application?
(14 answers)
Closed 9 years ago.
How can i generate serial key for the C# Desktop Application (Windows application) ?
E.g. Software expires after a month. (Trial version).
If user changes Machine time then hoe could it be possible to validate the software for the specified time ?
There are many ways you can generate serial keys for your application in C#. You will most likely have make some sort of trade off between the simplicity (ie. the length of the key, readability, etc), and the security of a particular system.
I would recommend Software Protector(http://softwareprotector.clizware.net/) and SKGL (https://skgl.codeplex.com/). Software Protector would give you a user interface where you can generate your keys and SKGL API would allow you to validate those inside your own application. If you like, you can also include the source code of SKGL API (currently available in C# and VB.NET). You can set a time limit from 0 to 999, 8 custom features, and machine locking.
Regarding the time changing issue, the only way I see is to look up the local time (for that time zone) online using time.windows.com and check if that is equal to the current time on the pc. Please check this article: https://skgl.codeplex.com/discussions/472444
Please note that I am developing both SKGL API and Software Protector, which means that my answer might have a slight tendency!
This question already has answers here:
How to detect when laptop power cable has been disconnected?
(7 answers)
Closed 9 years ago.
I'd like to call an API to know if the laptop is plugged into the wall. If it is I want to defer some CPU intense processing in order to save battery
I'd also like to be informed when this status changes (meaning when the user plugs the charger back in I'd like to be alerted)
in Win32 I'd probally go this route - RegisterPowerSettingNotification
is there something like this in .NET/C#?
I believe you can check SystemInformation.PowerStatus to see if it's on battery or not.
Boolean isRunningOnBattery =
(System.Windows.Forms.SystemInformation.PowerStatus.PowerLineStatus ==
PowerLineStatus.Offline);
Edit: In addition to the above, there's also a System.Windows.Forms.PowerStatus class. One of its methods is PowerLineStatus, which will equal PowerLineStatus.Online if it's on AC Power.