Open coudys opened 1 year ago
the code uses screen space overlay canvas, which means it takes in account the screen height and width and caches it. so you will need to update the screen width and height when ever you rotate your device
@coudys
You could just add this line to OffScreenIndicator
public class OffScreenIndicator : MonoBehaviour
{
// rest of the code
void Awake()
{
mainCamera = Camera.main;
TargetStateChanged += HandleTargetStateChanged;
}
private void Update()
{
screenCentre = new Vector3(Screen.width, Screen.height, 0) / 2;
screenBounds = screenCentre * screenBoundOffset;
}
// rest of the code
}
I have never in my life seen more clean code for any unity project than this repo. This man is a clean code genius. And expert programmer. I wanted to apply to your company just so that I could meet this person. I pray, where every you might be, I hope you have a really satisfying life.
I have few canvases in my project and when changing between portrait and landscape on my android device, all UI canvases adjust to it apart from this UI off screen indicator canvas. Seems the rectangle of canvas remains either portrait in landscape or vice versa. Indicator arrows are there, just not reaching new canvas limits.