Howdy, Stranger!

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

Sprite renderer problem


I have two scenes a menu and the actual game. I have a game object called Background and I made it a prefab to use it in both scenes. I've put a script on Background which changes the sprite used for the background with a Sprite Renderer.

In the menu it works properly, but in the game scene I have a problem: I'm using game states and at void Start I change the game state to generating a grid.

Here's the grid generating script (boardPrefab is a Sprite Renderer):

And for some reason I just can't figure out why, sometimes the grid doesn't appear. With the first/default background it always works but if I change the background for some it doesn't show and it's random which ones. One time it worked perfectly all of a sudden without any change to any of the scripts but then it went back to being bad. Even if I build the game its bad for some themes. Please help, I need this for a school project and I just don't know why it's not working.

Some of you might recognise the script, yes yes it's not original work (at least the game manager script).

Best Answer

  • BBMLBBML Member
    Accepted Answer

    It has been solved!

    The solution: So this was a 2D project and the Background game object was 10 on the z axis and the grid and everything else was on 0. I had to put the Background game object farther back on the z axis to be axact I put it on 100 and this solved my problem. (So it wasn't the sprite renderer)

Sign In or Register to comment.