Welcome, Guest! Login | Register
toggle/button affecting different scene
Info
Report
264 Posts

is it possible? i want to make it so that if i press a button an object from another scene is set as active
Created on: 1 year ago
Info
Report
261 Posts

You could do that with a static script with a boolean. So when you press the button, the boolean is set to true, and the object will be active (considering you make a script that reads that boolean as input to turn it on/off). It might not be the cleanest approach, but it's simple and works


Now, a short explanation:
When you create a script that is static, it means that you cannot create instances of that script, In a way that you cant put it on an object, as its...static, but it will always be there. Static scripts are useful when you want to carry data from one scene to multiple other ones quick and easy, for instance, game settings for mouse sensitivity or anything you would like to access later.

The image is an example of this. It carries some info about pixelation and audio, and I can get these values on any scene, anytime. This is probably your best choice if you wanna go simple, but keep it clean!
Created on: 1 year ago
Edited on: 1 year ago
Info
Report
264 Posts

thanks for the reply doom! i'd have a couple of questions since not everything is working as intended and its probably just me not paying attention to obvious mistakes, but for that kinda stuff i wanna use dontdestroyonload until i deem it realistic
Created on: 1 year ago
Reply
Preview
Post
Or use the advanced reply form here...
Sponsored