fungus

Open full view…

Want to hide Rewind btn at certain point in game, Set Active false not working

gs3
Sun, 06 Jan 2019 13:51:31 GMT

I'm stumped. I want to turn off the Rewind button for a small section, but using the Set Active false command on the button does not work. I tried it with the whole panel, then with the whole SaveMenu object, but it persists. I get a "No game object selected" message when the game is played, but when it is not being played the command looks just right. Does anyone have a workaround? thanks!

wolfrug
Mon, 07 Jan 2019 08:24:37 GMT

I believe the entire save dialog thingamajog is put into "don't destroy on load", which means the reference to it is no longer valid after you actually start the game! You'll probably need to access it in some other way, probably involving a custom command. Unless Steve has some fancy workaround?

gs3
Mon, 07 Jan 2019 11:05:18 GMT

Yes wolf that is the case. There are a lot of threads I have found on general Unity boards that end up with telling people not to mess with dontdestroyonload. I did put Savemenu on another canvas but that threw errors. One possible thought was to construct a way to not be able to rewind back past a certain block. That hasn't worked either.

wolfrug
Mon, 07 Jan 2019 13:26:03 GMT

Your initial idea is probably the easiest. What you could do is: - Make a custom command that finds the savemenu (there's a static instance, so SaveMenu.Instance will find it for you). - In SaveMenu.cs, change the "protected" status of the "rewindButton" to "public" - In the custom command, make the rewindButton non-interactable by accessing it through the savemenu. - Use the same command to make the rewindButton interactable again when you need it to be. Might work? The biggest problem here is of course having to edit SaveMenu.cs. In a sense, it might be better to rather than changing the protected status of the button itself, to create an entirely new function inside the SaveMenu.cs that disables/enables the button. You just have to remember to re-add that every time you update Fungus!

gs3
Mon, 07 Jan 2019 15:04:47 GMT

It sounds like that way would be opening a lot of doors to some issues that I wouldn't need. I'm almost to the point of maybe creating some kind of mask that just goes over the sprites and hides them, if I layer them higher and make them clickable and have them do nothing, it might just block the user from being able to back up for a while. I'm going to think about it some more, thanks again Wolf, you're a great resource.

wolfrug
Mon, 07 Jan 2019 16:43:04 GMT

Oh yeah :D That's of course possible, hehe. Sometimes the easiest solutions are the best! Just be mindful that the blocking image doesn't move etc. if you change resolutions (maybe copy-paste the actual save dialog to make sure you get all the same info).