유니티

[유니티] Resources.Load

SUGI_ 2023. 8. 7. 09:49

 

public class GameManager : MonoBehaviour
{
    [SerializeField] Transform pos;

    void Start()
    {
        //[플레이어 생성]
        //Resourecs 폴더에서 직접 가지고 오기
        GameObject player = Resources.Load<GameObject>("Player");
        //프리팹으로 객체 생성
        GameObject go = Instantiate(player, pos.position, Quaternion.identity);

        //[카메라]
        //시네머신 카메라 플레이어 따라가기
        GameObject.Find("CM").GetComponent<CinemachineVirtualCamera>().Follow = go.transform;
    }

https://learnandcreate.tistory.com/753

 

유니티에서 Resources.Load 함수를 사용하여 에셋 로드하기

유니티에서 Resources.Load 함수를 사용하여 에셋 로드하기 Resource 폴더는 유니티가 특별한 목적으로 예약한 폴더 중 하나로 해당 폴더에 에셋을 위치시키면 load함수를 사용하여 불러오기할수있다.

learnandcreate.tistory.com

 

728x90