PUN Classic (v1), PUN 2 and Bolt are in maintenance mode. PUN 2 will support Unity 2019 to 2022, but no new features will be added. Of course all your PUN & Bolt projects will continue to work and run with the known performance in the future. For any upcoming or new projects: please switch to Photon Fusion or Quantum.

프리팹 ID

컴파일된 각 프리팹은 "프리팸 ID" 이라고하는 유일한 id를 얻게됩니다.

프리팹ID의 사용

프리팹 id는 ID를 사용하여 볼트 프리팹을 인스턴스화하는데 사용할 수 있습니다. 게임에서 오브젝트의 드롭 시스템을 만들어 이벤트에서 프리팹을 전송하려면 이벤트에 새로운 속성을 추가하기만 하면됩니다. "프리팹 id" 를 "ItemToDrop" 이라고 정의한 다음 다음과 같이하십시오.

void DropItem()
{
    using(var evnt = DropItemEvent.Raise(Bolt.GlobalTargets.Server))
    {
        evnt.ItemToDrop = Item.DropPrefab.GetCompoment<BoltEntity>().ModifySettings().prefabid;
            
        //ModifySettings - this isnt for editing the entity, its for getting the modifysettings of it.
    }
}

override OnEvent(DropItemEvent evnt)
{
    
BoltNetwork.Instantiate(evnt.ItemToDrop); //Instantiate a prefab with the prefab id that we transmited in the event.
    
}

기술문서 TOP으로 돌아가기