Forum rules - please read before posting.

ActionListParameters problem

Namely, let's say I have more lights (lamps) in the scene and I want to turn them on and off and vice versa. The best way would be to use parameters to control them through one Action list , if this is possible!

So, I made a smaller scene to test the parameters. I have two lights.
A and B which I want to turn them ON and OFF trough parameters. In ActionListParameters I have an object (gameObject), a light (gameObject), a variable (boolean) for ON and OFF state and maybe a sound(gameObject).
However, the problem is that if I put a boolean variable to control them associated with the parameters I get such problem that, for example, the first light A turns ON and OFF normally, but the other light B has a problem of delay at the first click of the mouse and then reacts normaly ON and OFF. The same thing happens if I want to turn OFF lights, no matter which A or B, the second one is with delayed click. I realized that this is because they share one boolean variable for all actions and if I want to click to turn on other light B it first needs to go back from true to false and then to true...I hope this makes sense...

Is it possible to control lights trough the parameters! Is there may be some better way for this without making special variables for each light?

Oh and I use Unity 5.6.1f1 and AC 1.56g

Comments

  • this is because they share one boolean variable for all actions

    Parameters are properties of the ActionList. To keep track of the state of different lights in the scene, you would need separate variables.

    To rely on parameters, you would need to define each light's "on state" as a Global Variable, and then pass that variable as a "Global Variable" parameter to the ActionList. The ActionList would then read/set the variable, and not its own "Boolean" parameter.

    Alternatively, you could look into relying on an Animator controller to handle the changing of the light intensity / material via a Trigger Animator parameter. That way, simply invoking the Trigger would toggle the light on/off regardless of its previous state.

  • edited February 2019

    I figured it was something like that! This with an animator is an interesting idea. I'll certainly try it,thanks Chris

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.