Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Slater on August 10, 2012, 11:31:02 AM

Title: Application.systemLanguage
Post by: Slater on August 10, 2012, 11:31:02 AM
When my game starts I want to check if there is already saved a language in playerprefs. I have already managed to save languages in playerprefs, so if a user changes language once in the game, it gets saved and remembered.

However when the game is started for the first time, I want it to check for what the system language on the device is set to. As far as I understand it, you use Application.systemLanguage for this in Unity. How do I use it in Playmaker? I cant find a solution for this. So what I need is

Game starts
Check playerprefs, if key is true = done
If key is false, load application.systemLanguage

Well maybe as you can see Im not a programmer :) Hope anyone can help me out here :)
Title: Re: Application.systemLanguage
Post by: Slater on August 12, 2012, 06:26:53 PM
Can anyone help me with this? Do I first need to make a javascript containing application.systemLanguage and then add that script through Send message in FSM? If so, how should I write it in js? I have never coded before, so have almost no knowledge about it. I tried the idea above writing a js containing this:

#pragma strict

function SysLang () {

guiText.text = Application.systemLanguage.ToString();
}

But I am not sure if I did the right thing. I then added the script to the object I have the FSM on and in Send Message I typed in SysLang
Tried none in parameter and also as string.
I have another object as Gui Text and tried to put that as game object.
Neither worked.

Any suggestions?

Im trying to get the language from Ipad and Iphone.
Title: Re: Application.systemLanguage
Post by: jeanfabre on August 13, 2012, 03:36:56 AM
Hi,

 here we go:
http://hutonggames.com/playmakerforum/index.php?topic=2107.0 (http://hutonggames.com/playmakerforum/index.php?topic=2107.0)

this is an action that works in playmaker, so you don't have to script anything.

bye,

 Jean
Title: Re: Application.systemLanguage
Post by: Slater on August 13, 2012, 08:31:54 AM
Hi, thanks a lot, it works great!
Title: Re: Application.systemLanguage
Post by: Slater on August 13, 2012, 09:02:42 AM
Hmm, I have one problem though. I have put it in a separate state and it checks it and Ive set it to show it in GUI text and that works fine, but it gets stuck in that state no matter what I do. I have tried to set FINISHED and move over to another state. I have named an event and tried that without luck and I have tried putting in a "wait" for 1 sec to see if that helped but it is stuck in that state.

Any ideas?
Title: Re: Application.systemLanguage
Post by: jeanfabre on August 13, 2012, 10:46:19 AM
d'oh. forgot to add the "Finish()" call, VERY important, else as you experiences, you get stuck in that state without triggering the FINISH event.

 please download again from the same spot, it's corrected now...

 conclusion: never work before your breakfast :)

bye,

 Jean
Title: Re: Application.systemLanguage
Post by: Slater on August 13, 2012, 11:21:59 AM
Haha, do as I do. Dont go out of bed until lunchtime :) Well it got me trying a lot of different things that didnt work, but I think I learned a few things on the road anyway. Cheers!