Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Use Wordpress as your game's database

Discussion in 'Assets and Asset Store' started by MrDude, Feb 17, 2014.


If I were to build the kits in order of preference, which kit would you like first?

  1. Friends system: Invite friends and see what they are playing. Include PM and chat services

  2. Online privacy: Protect your info select exactly who can see what

  3. Message boards system: Categories for author, clan leaders, groups personal

  4. Online market place: Trade with NPCs or real players. Includes gifting service

  5. Custom character system: Create a character in one game and take him into other games

  6. 2D narrative game template: Write a story, build a game in a day...

  7. Clan system: Access your friends arsenal during your own battles

  8. Wordpress Games portal: Display available games, sell them and show stats (ratings/reviews)

  9. Other: Please specify...

Multiple votes are allowed.
  1. Magasenakwa


    Oct 13, 2018
    In the above example the first function will catch the transaction when it completes as long as your item has an SKU along the lines of: WUSKU_GameID_MYINV.

    In that function it will make two entries: First it will add the SKU to a comma separated string. Secondly, it will fetch the current stock levels and then update it with the qty selected during the Woo checkout.

    Now that you have your purchased items saved and you have your stock updated, the next thing is of course to fetch that info inside of Unity. For that I added 2 functions:

    customGetPurchasedItems() will return the list of purchaed items. In Unity you just split the string on ',' and that will give you the SKUs of each individual item to ue however you wish.

    The second function requires you to provide a comma separated list of SKUs and it will then return the qty of each item. Send it 1 or send it the complete inventory a subset... you choose, it returns the qty for those you chose...

    To call those functions in Unity you would do something like this:
    Code (csharp):
    2. public void GetListOfPurchasedItems(CML onSuccess, CMLData onFailed = null)
    3. {
    4.     WPServer.ContactServer("GetPurchasedItems", filepath, "CUSTOM", null, onSuccess, onFailed);
    5. }
    7. public void GetStockQuantities(CML onSuccess, CMLData onFailed = null, string items)
    8. {
    9.     CMLData data = new CMLData();
    10.     data.Set("inventory", items);
    11.     WPServer.ContactServer("GetInventoryStock", filepath, "CUSTOM", data, onSuccess, onFailed);
    12. }
    14. public void GetStockQuantities(CML onSuccess, CMLData onFailed = null, string[] items)
    15. {
    16.    string combined = string.Empty;
    17.    foreach(var s in items)
    18.       combined += $",{s}";
    19.    combined = s.SubString(1);
    20.    GetStockQuantities(onSuccess, onFailed, combined);
    21. }
    23. string[] products;
    24. void PrintError(CMLData response) => Debug.LogWarning( response.String("message") );
    25. void Start() => WULogin.onLoggedIn += FetchMyPurchases;
    26. void FetchMyPurchases() => GetListOfPurchasedItems(GetStockQty, PrintError);
    28. void GetStockQty(CML response)
    29. {
    30.    products = response[1].String("products").Split(',');
    31.    GetStockQuantities(PrintQtys, PrintError, products);
    32. }
    34. void PrintQtys(CML response)
    35. {
    36.    var items = response.Children(0);
    37.    foreach(var item in items)
    38.       Debug.Log($"I own {item.Int("qty")} of item {item.String("name")}}");
    39. }
    Of course, all of this is just one quickand dirty way to get things up and running so don't think this is THE way to do it. This can definitely be improved upon by, for example, NOT using usermeta and creating a custom table instead. Like I said, how you store and retrieve your data is up to you. This is just one example...

    The old Asset Store is closing next week. If you haven't saved out your invoices numbers by then then proving you own any of our assets later on will be up to you to do. PayPal transaction ID's are not gonna cut it! Save your invoice numbers while you still can!
    Last edited: Apr 18, 2019
  2. Hamesh81


    Mar 9, 2012
    Ok sure that makes sense, thank you for your detailed answer.
    Magasenakwa likes this.
  3. Magasenakwa


    Oct 13, 2018
    PLEASE NOTE: MBSCore has been updated for Unity 2019.1

    In addition.... We think we FINALLY figured out WHAT started the chain of events that led to all our assets being removed from the Asset Store and the "problem" is fixed now also. Please note the quotes aroundthe word "problem".
    Also, as should be painfully obvious by now, the update and "fix" will NOT be available via the Asset Store.

    MBSCore on the Asset Store is broken and thanks to the WWW class now being obsolete it will require you to manually update the Utilities class in future or else all assets that depend on it will be broken also.
    WordPress Login, for example, will not work any more unless you fix it yourself... And considering that all of the WordPress assets rely on WordPress Login, well...

    For now you will be stuck with an annoying warning message but once they remove the WWW class frfom Unity entirely, our assets will stop working unless, for each project, you manually do all the fixes that we would have done... well, actually, HAVE done... but are just not allowed to give you.

    So, why then all this hassle? Well, Unity refused to let us upload the fixed version and for weeks we were baffled by what they could possibly mean when they tell us that "something is wrong with something somewhere. Please fix it and resubmit". All we had to do to fix the broken MBSCore was change a 3 to a 4 in 2 places... what could possibly now "be wrong in something somewhere"?

    The actual decline message was more like "A texture or file or prefab could not be found, is not linked or not present. Please fix this and resubmit". This was absolutely useless in terms of figuring out what they were complaining about and more so when looking at the console and seeing there are no errors or warnings at all ... so what did they want MrDude to fix?

    MrDude spent weeks asking them on the forum, via email and also during the asset submission comments section but received absolutely no response from anyone at Unity except for the same copy pasted decline message that basically said 'Something is wrong with something somewhere. Please fix it'. After weeks of asking for help they decided to kick us off the store instead because MrDude was too unprofessional to be on the store after 8 years of nothing but rave customer reviews and having had priority submission privileges for most of that time...

    Now, almost 8 months later, we think we finally figured out what the reason was for the asset being declined. The thing MrDude kept asking Unity to point out to him and the thing they couldn't be bothered to answer him for for all those weeks... The problem was with something completely unrelated to the fixes applied to the broken asset...

    You are gonna love this:
    For the Entities demo MrDude had created a sphere from the GameObject menu, turned that into a prefab and then used that in the demo to show numerous instances of the prefab in the scene. It worked perfectly... but Unity wanted him to create a new material to apply to the prefab even though it was not needed. And THAT is ALL!!! Just THAT!!!

    So in order to get MBSCore approved he simply had to do one of two things:
    1. Create a material for no reason other than to make Unity happy
    2. Delete the prefab from the project and do this:
    Code (csharp):
    1.            //Instantiate(prefab);
    2.             GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere); //new
    3.             sphere.AddComponent<EntityClass>();//new
    And that was that!

    Weeks of asking Unity "What am I supposed to do? How do I fix it? What does 'Something is wrong with something somewhere' mean?" and all he got back was nothing. All it would have taken from Unity was to reply with "We want you to create a material for the sphere, even though you don't need it" and then everything would have been sorted...

    Instead, they couldn't be bothered to write that incredibly long response and now, after 8 years on the store, he got kicked off and all our products have been removed from the Asset Store meaning anyone who bought anything in the past is now doomed to forever download outdated assets (and in the near future be stuck with non-functional assets) unless they come get the updates from our site directly.

    All those weeks he asked them "Just tell me what to fix and I'll fix it" and all these months later he solved the mystery on his own..! Seriously, would it have been THAT much effort, during all those weeks of constant asking for help, to just TELL him that THAT was why the asset was being declined all the time? Instead, after 8 years of being on the store and getting rave reviews from customers about exceptional customer support they deemed him too unprofessional to be on the store and now leave you to download outdated assets, just waiting for them to break them in a future release of Unity... Total facepalm.

    In any event, please be advised: The 2 functions are still broken on the Asset Store version of MBSCore and will forever remain so since Unity won't allow us to fix it. Also, 2019.1 warns of the imminent death of MBSCore and all dependent assets if you continue to download it from the Asset Store. Download the updates from our site if you want your assets to continue working.
    Last edited: Apr 24, 2019
  4. Magasenakwa


    Oct 13, 2018
    Also, please be aware that I don't come by this thread/forum very often.

    I am the owner of myBad Studios but MrDude, being my only employee, has run it since day one. I've stayed out if it and like a good boss just said: "You do what you have to do, if you need me, I'll be in my office counting the money you made me... I mean us" ;)

    I only started coming here after MrDude was kicked off so SOMEONE could tell you that your assets are still being updated and you still have access to everything you bought. I stopped coming by for a while again and just thought I'd check in "just in case" a few days ago. After this post I don't know if/when I'll check in again.

    Any customer who needs support, please contact us via email or the support form on the website and MrDude will get back to you ASAP. If you need any help with anything, posting on here is likely to go very long without a response.

    Thank you all.
  5. jonathangunn


    Apr 24, 2019
    Great job!!! I'll probably use your plugins when have time. I would like even to test all abilities you provide. Thank you for your work.
  6. Hamesh81


    Mar 9, 2012
    Hi @Magasenakwa ,

    I have a question about the integration between the Login and Data assets to see if these can achieve my particular use case.

    In my Woocomerce products I am using the ACF plugin to add two additional text fields as backend only meta boxes. ACF fields get saved in the database table wp-postmeta. In Unity what I need to do is for the logged in user (via Login assets) to get a list of all of the products that user has purchased and be able to store the values from the ACF fields into a Unity variable for each of these products.

    I understand I would need to handle all of the display logic the list of products, but is the actual getting of the products list something that the Data asset can assist with?
  7. Magasenakwa


    Oct 13, 2018
    Our website was made back in 2008 and since then we never allowed for account creation on the site. This meant 0 spam accounts in 10 years... Then, after Unity threw their little hissy fit we opened up the site to provide support to our customers who would otherwise be screwed over by Unity's little tantrum.

    It's been less than a year but the number of spam accounts created has been about 150% comparerd to actual accounts. This resulted in a hard choice for us: live with daily spam account removal OR tell you all "You've had nearly a year to register with us. If you haven't already then you most likely won't so all customers who haven't created accounts with us already, tough to you"

    So basically we had to choose between a rock and a hard place but wanted neither. Fortunately, we are the WordPress for Unity people :D So starting this week we decided to do neither. :)

    Starting earlier this week we disabled the ability for people to create accounts on our website. Bye bye bots. We are back to having WordPress saying no to all new accounts. Then we replaced the current login form with a WebGL build of WordPress Login and display it on the page using the Unity WebGL App display shortcode included inside WordPress Login. So, what that means is that we now do account creation on the website exclusively via our very own asset :D

    The irony here is that, while WordPress Login has always allowed you to create accounts on your website from within Unity, we were recently asked to update the kit to NOT allow account creation from within Unity if the developer chooses to disable that option. Now that we have added that feature on the website end to NOT allow people to be able to create accounts... we now use WordPress Login as the exclusive method for actually creating accounts on our own website :D

    Last edited: Jul 18, 2019
  8. Magasenakwa


    Oct 13, 2018
    New version of Wordpress For Unity is being released on 1st September 2019. See the changelogs to see what is new!

    1 September is the 8 year anniversary of MrDude joining myBad Studios fulltime
    5 October is the 1 year anniversary of myBad Studios leaving the Asset Store
    On these two dates you can get 50% off on everything on the site using the voucher: anniversary

    Thank you to everyone for your continued support