void Update()
{
if (CheckSunlightCamera.Instance.IsCatchingSunlight())
{
ResetPlayerPosition();
}
}
void ResetPlayerPosition()
{
playerTransform.position = new Vector3(0f, 1f, 0f);
}
So, this is a piece of code that goes at the bottom of code that i’m using to detect whether a player is in sunlight or not. I have a ‘playerTransform’ Serialization up at the beginning, and this code works with every gameObject under my Player gameObject, but not the Player gameObject itself. I’m feeling like there’s been some small oversight, but I can’t figure it out at all.
I hope that makes sense. Thank you for reading!