How to make in-game- unlock code (like asdfg-12adf-132fg) system?
And if user input some of these code, specific items or benefit given.
How to make in-game- unlock code (like asdfg-12adf-132fg) system?
And if user input some of these code, specific items or benefit given.
Create a GUI.TextArea and in the second parameter use a string var that you created. then just compare in a if condition(ie)
var code0A : String;
if((code0A == “asdfg-12adf-132fg”)(Input.GetKeyDown(“m”))) {
washMyCar * 5;
//Oh and unlock any thin i want.
}
Off the top of my head i think thats all you have to do.
Then how deal the code storage, database?
Is it also by script in unity? How deal some hundred or thousand codes?
How to put the legitamate code in storage? Also by scripting in unity?
Then if released game, continuously update new build after input codes?
If you want to store the key on the user’s machine, you could probably use the PlayerPrefs system. However, you will need some kind of database if you want to record the keys used on a server. See the Server side highscores example on the Unify wiki for further details.
Iirc Eric5h had a fancy paypal driven payment and registration system he was selling at one time. Checked his website but didn’t see it listed. Might want to shoot him an email.
Still selling it, but it’s not listed with my other utilities since it’s somewhat more complex to set up and requires more support than normal. You can request it if you’re interested. See Fractscape (free demo, check link in sig) for an example of how it works. From your description, I’m not entirely sure my system is actually what you want though. For example, I don’t use a database of codes; they’re generated from the purchaser’s name and email address.
–Eric
So, I know this must be related with mysql and php.
And I saw highscore mechanic at unify wiki.
So, unlock code mechanic consist of two sides.
This can be done by similar mechanic with [addscore.php] mechanic.
I input some randomly generated codes like [R8K0ZN6] to database by some unity webplayer made for this purposes or directly by login to database.
I now struggling to this stage.
1. From unity side, user click [unlock code]. -> Text field appear and waiting user's input. (Can be done easy by unity GUI)User input from1. stage trigger some script from serverside’s like compare.php
This script perform searching the database and compare user input with it, and returns the values of TRUE or FALSE.
(I don’t know well how to achieve this)
Unity player waiting until 2.'s compare.php returns value. And then, take value, if it is false, error message pop up, if it is true, item unlocked.
(How to achieve this?)
According to unifycommunity.com ,
function getScores
…
This function says [ hs_get.data ]
But I don’t know what this mean and how this work?
.data does not exist in WWW’s unity script reference?
And how to scripting compare.php and how to communicate with it from unity whether it returns true or false?
hs_get.data actualy holds the data that comes back from the php, it’s the same as www.data.