private void MovePfpInRandomPlace()
{
RectTransform moveArea = avaliableMoveArea.GetComponent<RectTransform>();
Vector3 areaPosition = moveArea.position;
Vector2 areaSize = moveArea.rect.size;
float pfpWidth = pfp.GetComponent<RectTransform>().rect.width / 2;
float pfpHeight = pfp.GetComponent<RectTransform>().rect.height / 2;
pfp.transform.position = new Vector3(
Random.Range(areaPosition.x - areaSize.x/2 + pfpWidth, areaPosition.x + areaSize.x/2 - pfpWidth),
Random.Range(areaPosition.y - areaSize.y/2 + pfpHeight, areaPosition.y + areaSize.y/2 - pfpHeight),
0
);
pfp.gameObject.SetActive(true);
}
https://drive.google.com/file/d/1iwPVN4J6wuN8-1rhh...