Simple weather simulation, effects on/off keypress?

Hello all,

Just started using unity very recently and was wondering if I could get some help, my knowledge on scripting is less than advanced but the inbuilt wind system in unity, how would I go about turning the wind on and off with a keypress?

Thanks

Hello and welcome!

I am not familiar with any wind system in Unity but the concept of how to toggle a setting is that you’ll want to create a script that handles your inputs and do something based on that. You then add this script to a GameObject in your scene.

  1. Asset → Create → Script (of your language of choice)
function Update() {
    if(Input.GetKeyDown(KeyCode.W)) {
        myWindSystem.active = false; // see note
    }
}
  1. Drag that script to some game object within your scene.

Note: as I said, don’t know what system you’re referring to so this line of code is just an example.

Hope that helps!

Hello thanks alot for the help, the system I was referring too was the “Wind Settings” in terrain settings, however, I might well be thinking this does more than it actually does, basically I was hoping to set this really high or off with a keypress, to effect the bend of trees or such in the environment, but maybe perhaps I am looking at this the wrong way, thank you for the code, I shall attempt to use it to turn off other particle systems for now anyway