Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: nmillett on March 10, 2019, 01:04:36 AM
-
Hey fellow playmakers!
I'd like to have a game object (in this case a canvas screen) only load once when my application boots to a scene. The next time it reloads, I would like it to be destroyed and not load. I've managed to have it destroy itself upon disabling the object however it comes back when I load the scene again. I understand you can set up a variable and do a reference check however I was hoping someone could outline how it would look with an FSM. Much appreciated!
Cheers,
Nate
-
Alternative can someone go over the setup for playerprefs using "set int" and "has key". Having no luck with it!
-
You could use a global bool variable to determine whether it is supposed to be gone or not. However, it will reset once you quit the application.
simply, make a global bool variable "IsDestroyed"
then in your FSM,
bool test "IsDestroyed" if TRUE then do nothing
bool test "IsDestroyed" if FALSE then destroy it.
If you want to persist even after you quit the application, you need to use player prefs.
to do that, use
Playerpref gets bool | key :<yourkey>| and save it to your bool variable, then continue as the previous step. Also, don't forget to set Playerpref with your new bool after you destroyed your canvas, so the next time you load, it will persist.
btw, what is your problem with the int playerprefs setup?
-
Thanks for the swift response. I was overthinking things as usual and needed to change the variable to a bool as you stated. I was using an int. :o
Now it functions. Yippie!
-
To follow up with your question... Just wasn't sure if it was working with Playmaker but it was my fault. I have Easy Save installed and am going to start migrating the serialization over but waiting to clone the master build before diving in. I understand playerprefs is easily hackable... I think for this circumstance who cares about canvas elements but when it comes to inventory management and player progression I see it being a serious problem for in-app purchases and such. Any threads pertaining ES3 out there I should take a look at?
Thanks for the help!
-
If you have Easy Save, then you have the best saving tools available, you can't go wrong with it!
I never use ES3, but ES2 did a good job overall.
in-app purchase is always a hassle as for the security, you should try to look at the Obfuscation method.
Hacking a mobile is not an easy job by nature, but still, no matter how good your security technique is, it WILL get hacked once it's getting popular, but by then, you probably rich already 8)
GL with your project!
-
So here it is:
All this FSM is attached to one specific button. In this example, when you want to buy a tank01.
Node blue "Button", there is nothing, is activating only when you Click on it.
Hope, is it helpful ;)