C# script to change the position from one plane to another plane (make the background flashing)

My game is supposed to change from background1 (plane) to background2 and then go back to background1 (it looks like flashing) before the game scene ends.
How should I make the script for doing that?
Thanks in advance :slight_smile:

There are so many ways to do this it’s kind of hard to choose just one.

A really grungy way to do it is put one background in front of the other. So you have front and back.
Now, disable the front, then reenable it.

I think the code is gameObject.SetActive(false) to disable (this is in c#) and use SetActive(true) to enable.

Something like…

public GameObject front;
public GameObject back;

public void FlashBackground()
{
front.gameObject.SetActive(false);
//(some kind of delay)
front.gameObject.SetActive(true);
}

Another way would simply change the texture back and forth on a single object.

If you aren’t literally showing an image, you just want some kind of flashing effect… I’d look into some other method.