- Home /
Making Multiple Switches Affect Different GameObjects
I've been trying to make a fairly simple puzzle game, but I came across an issue when I tried to create switch-like objects. Essentially, when the switch is on, I want it to do multiple things, like open a door and rotate a different GameObject, and when it's off, the door closes and the GameObject rotates back. One of the most important aspects is that I want the switches to affect different things, I.E one may open a door and rotate something, the other might change somethings color or move a GameObject.
I tried to achieve this through delegates and events, but the result was... a bit strange? It worked at first, but adding a second switch either outright broke the system or made things act weird, such as the wrong objects activating or the switches sometimes doing something but other times doing nothing. Just not the result that I wanted.
I'm wondering if anyone has other solutions to this issue? I'd highly appreciate any responses! Thanks in advance.
Your answer
Follow this Question
Related Questions
Help to understand events and delegates (Game Manager) 2 Answers
Unity Events - Subscribe and Unsubscribe Odd Behavor 0 Answers
Plug and Play UnityEvents/Methods? 1 Answer
Using Delegates for separating UI and Logic, are these in the right place? 1 Answer
Can a function derived from MonoBehavior subscribe to a static delegate? 1 Answer