I'm having a bit of a headscratcher with the parallax component. If the option "reacts to:" is set to "camera", is the camera position relative to the element the only variable taken in account?
I'm asking because I have some elements with parallax inside a prefab, and I have the distinct impression that depending on where within the scene the prefab is injected, the calculated positions change wildly, even if the camera (being inside the prefab) is always in the same position relative to the elements. This prevents me from being able to inject this prefab in more than one position within the scene, because each different positioning would require different offsets in the parallax component to "fix" the effect.
Here's the prefab, if I place it close to 0, 0 in the scene
Here it is if I place it at y: 50
Here it is if I place it at y: -50
Again, in all instances the camera is always in the same position relative to the sprites because it's part of the prefab itself.
I would like to understand why this happens and if there's a way to work around it, so I can place my prefab wherever and always have a consistent behavior
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
What are your AC/Unity versions, and what are the component's settings? Are you applying a background constraint?
unity 2021.2.14f; AC 1.81.6
Component here
The offset here is a fix for the aforementioned problem, for when the prefab is placed at x = 0, y = 50. when I took the screenshots in the first post the offset was of course 0.
No background constrains
The parallax effect ought to be applied as an offset to its original position.
Are you spawning the prefabs in at runtime, or are they being placed manually in the scene beforehand?
As this is an animation issue, I'm not clear enough on the effect you're experiencing vs how it should be. If you can PM me a test scene, along with the prefab and its sprite, I'll take a look.