1
\$\begingroup\$

I have a seamless background sprite, and I do not want the player to be able to reach the edge of the background.

Setting huge width and height in tiled drawmode doesn't sounds like a solution. How can I make something like this?

I want the background to appear outside the camera in the direction the player is moving.

I think instead of instantiating and destroying background panels every time I should once create them and then change their position.

\$\endgroup\$
6
  • \$\begingroup\$ It sounds like you have two valid solutions: making a huge sprite with tiling draw mode, or spawning panels of the image at a time and repositioning them as needed. Where do those solutions fall short of what you need? \$\endgroup\$ Commented Oct 27, 2021 at 16:23
  • \$\begingroup\$ @DMGregory I don't know how to create a script that will reposition panels, that's what I'm asking. Does creating a huge sprite affects performance? If not then I'll just make a huge sprite. \$\endgroup\$ Commented Oct 27, 2021 at 16:33
  • \$\begingroup\$ "Does X affect performance" is something you can answer more conclusively by measuring it. That way you don't have to worry about Internet hearsay giving you the wrong info — you can access the truth of the matter directly. \$\endgroup\$ Commented Oct 27, 2021 at 16:35
  • \$\begingroup\$ You could also attach your background sprite to your camera, and use a shader to tile the texture in worldspace, so it automatically maintains a fixed relationship to the world even as the sprite/camera moves. \$\endgroup\$ Commented Oct 27, 2021 at 16:38
  • \$\begingroup\$ Looks like you forgot to set the wrap mode on your texture in the import settings to "repeat". \$\endgroup\$ Commented Oct 27, 2021 at 18:37

1 Answer 1

0
\$\begingroup\$

Attached background sprite to camera and then used that shader

Remember to set the sprite wrap mode to "repeat"

\$\endgroup\$
1
  • \$\begingroup\$ This looks like a link-only answer. You could include additional information about how your solution might work, and a simple guide on how to set it up to address OP's issue. \$\endgroup\$ Commented Oct 28, 2021 at 9:48

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.