playMaker

Author Topic: Toggle Subtitles on/off  (Read 1021 times)

ForeverAutumn

  • Playmaker Newbie
  • *
  • Posts: 6
Toggle Subtitles on/off
« on: January 24, 2021, 09:01:50 PM »
Hello,

I've searched this question on google, but haven't found any information for a solution.

I was wondering how I go about making an FSM for an option to toggle on/off subtitles in multiple scenes. From, what I understand I would need to make a global variable, but I am unsure of how to go about it for this particular goal.

Any help would be really appreciated.

Thank you.

ch1ky3n

  • Full Member
  • ***
  • Posts: 208
Re: Toggle Subtitles on/off
« Reply #1 on: January 25, 2021, 07:47:35 AM »
if you want to use global var then it goes something like this

1. Make a global var SUBTITLE as Boolean
2. on each and every screen make a script to check if SUBTITLE = true
3. if true, then activate the subtitle, if false then deactivate it
4. those subtitles could be separate UI objects
5. SO it is wise to put the script on gameObject that has access to the subtitle game object, to make it simpler, like putting the FSM script on the canvas

Good Luck
« Last Edit: January 25, 2021, 07:49:15 AM by ch1ky3n »

ForeverAutumn

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Toggle Subtitles on/off
« Reply #2 on: January 25, 2021, 10:58:10 PM »
I will try this. Thank you very much for your help!

ForeverAutumn

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Toggle Subtitles on/off
« Reply #3 on: January 26, 2021, 12:40:31 AM »
I was able to get it to work so I can turn the subtitles on. Thank you! The only thing is, when I try to turn the subtitles back on nothing happens.

What I did:
1. Put all the subtitles in an empty game object then added an fsm to the canvas that has a Bool test action to test if the global variable is true or not. I messed up and made the global variable originally  false, so if in this case if the bool is true I deactivate the empty game object with all the subtitles. Within that state I have another bool test to see if the bool is false to activate the empty game object.

2. I have two buttons in my menu with ui on click event fsms, off and on, that trigger states with set bool value actions. The on is set to false and the off is set to true.

The bool stays at true after I turn the subtitles off and when I try to turn them back on it stays true.

Not sure what I am doing wrong.

ch1ky3n

  • Full Member
  • ***
  • Posts: 208
Re: Toggle Subtitles on/off
« Reply #4 on: January 31, 2021, 09:53:23 PM »
could you send a screenshot of your GUI button that toggles the on and off?



djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Toggle Subtitles on/off
« Reply #5 on: February 01, 2021, 07:03:52 AM »
Hi.
if you can, pls show some images of you fsm/states/actions

ForeverAutumn

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Toggle Subtitles on/off
« Reply #6 on: February 10, 2021, 02:12:00 PM »
hey I think I solved this. I didn't have the bool test set to every frame. Thanks.