PUN Classic (v1)、Boltはメンテナンスモードとなっております。Unity2022についてはPUN 2でサポートいたしますが、新機能が追加されることはありません。お客様のPUNプロジェクトおよびBoltプロジェクトが停止することはなく、将来にわたってパフォーマンス性能が落ちることはありません。 今後の新しいプロジェクトについては、Photon FusionまたはQuantumへ切り替えていただくようよろしくお願いいたします。

Prefab ID

Each prefab which is compiled gets a unique id which is also referred as the "Prefab ID".

Uses of the Prefab ID

The prefab id can be used for instantiating bolt prefabs with their ID.
If you would like to make a drop system for objects in your game
and you want to transmit a prefab in an event then you just add a new property to your event.
Let's say "ItemToDrop" and define him as "Prefab id" and then do something like:

C#

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.
    
}
Back to top