if (Box1List.Count == 10 && cubeList.Count<10) { float y; y = Ran[it]; it++; Vector3 Sq10Spawn = new Vector3(-6.3f,y, 0); Vector3 ClonePoint = Sq10Spawn; var targetX = Sq10Spawn.y; ClonePoint.y = targetX - 0.3f; Sq10Spawn = ClonePoint; // 이 부분들은 잘 모르겠어서 위치의 조금 밑에서 캐스트를 쏘기 위해 위칫값 바꿨습니다 RaycastHit2D hit = Physics2D.BoxCast(ClonePoint, new Vector2(3, 0.3f), 0, new Vector2(0, 1), 5f); if (hit.transform != null) { Vector2 hitPoint = hit.point; var targetY = hit.transform.position.y; hitPoint.y = targetY + 0.3f; Sq10Spawn = hitPoint; // 대충 박스캐스트를 위로 쏴서 있으면 위치를 0.3더한다는 느낌? } GameObject clone = Instantiate(Sq10, Sq10Spawn, Quaternion.identity); clone.name = "Sq10"; cubeList.Add(clone);


7cef8372abc236a14e81d2b628f1736e4485


동그라미 친 위치에 같은 직사각형 물체가 생성되게 코드를 짰는데

이 위치에 직사각형이 이미 있으면

그 감지된 물체에서 0.3 위에 생성되게 하고싶은데


잘 안되는데 진짜 코딩초보라 어떤게 잘못된지 모르겠는데 도와주실수 있습니까 ㅜㅜㅜㅜ