Spawning on Path dependent on the Y-Value of Waypoint(0)?

I have come across this unusual thing that if I have my Y-value of the first Waypoint(0) of my new Path at 10.7 or lower it works just fine no matter what the X-value is.


But if I change the value to 10.8 or higher the assets just blip for a split second and are not instantiated.

What could be the issue here?

Hi,

At which z-position is the background image? My personal recommendation would be to set the background image to z = 10, and the waypoints to z = 0. With “funny” values, it is often hard to tell whether somebody set these values on purpose or if they are just “random”. That makes debugging a bit more difficult.

If the background image and the sprites share the same y-position, you could get the infamous z-fighting effect. Usually the z-axis is the “depth”, in the case of Unity, it’s the y-axis. If they share the same y-position, the renderer randomly decides the rendering order. The enemies could appear in front of the background, and, suddenly, they seem to disappear.

Did this help?


See also:

Hey Nina! Thanks for the quick reply.

Waypoint and background doesn’t even overlap so I don’t think it’s a depth issue. ‘Background’ (prefab) was initially set to 0 but I now set it to 10 but it hasn’t changed anything.

Kind of a weird ‘issue’. :smiley:

Indeed. :confused:

Could you share the z-positions here which you are getting during runtime?

Also select all Waypoint game objects and set their z-position to 0. Since they are children, their position in the Inspector is relative to the parent. The parent should be at z = 0 (or a value between the camera and the background).

Privacy & Terms