PUN Classic (v1)、PUN 2 和 Bolt 處於維護模式。 PUN 2 將支援 Unity 2019 至 2022,但不會添加新功能。 當然,您所有的 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