please understand that I’m very new to coding and unity but I’m making a endless runner 2d game for ios.
i’ve got a background scroll which won’t stop scrolling once the player has died.
so I tried solving that problem with an extra bit of code on the scrolling background script -
public float speed = 0.5f;
public GameObject player;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (player.SetActive = false) {
speed = 0.0f;
}
Vector2 offest = new Vector2 (Time.time * speed, 0);
GetComponent<Renderer>().material.mainTextureOffset = offest;
}
}
the error pops up on these lines -
if (player.SetActive = false) {
speed = 0.0f;
}
Can anyone tell me where I went wrong or how to fix it?
Or maybe suggest a different way of stopping the background scroll.
I’ve searched around the internet so far found nothing of help,
other answers only led to me having this specific error.
All I want is for the background to stop scrolling once the player has died ![]()
any help is much appreciated.