Prefab.Instanciate() - How to use it in a different folder location

I was not able to spawn a prefab using the Instanciate() method from the BoltSingletonPrefab outside of your sample project. Is it possible to change the default location?

Comments

  • You can spawn prefabs from any location.
  • Using the singleton? I was not able to.
    They don't show up when I start typing the name.
    I build the prefabs and the assembly.. Do you know why they are not available?

    Is there anything special to be done? Do they need the Bolt entity component ?
  • Yes they do need to have the BoltEntity component. Follow this doc: https://doc.photonengine.com/en-us/bolt/current/getting-started/bolt-101-getting-started
  • I am talking about this folder structure, not for BoltNetwork.Instantiate, but Prefab.Instantiate():
    - singletons
    -- resources
    --- cubetest (this is the singleton example)

    If I don't keep the "resources" folder name, it won't spawn. Even if in Resources. I need a resources folder inside any other folder to make it spawn. It's not restricted to your advancedtutorial folder though.

    Your ref:
    https://doc-api.photonengine.com/en/bolt/current/class_bolt_singleton_prefab.html
  • Here is the source for it, this is all there is to it
    https://hastebin.com/dakinonuyu.cpp
  • Thanks.

    So I have a final question.
    If my folder structure is like that:

    1.
    -Resources (root)
    -- Prefabs
    --- Cube (singleton) <= that doesn't work

    2.
    -Resources (root)
    -- Prefabs
    --- resources
    ---- Cube (singleton) <= that works

    3.
    -Resources (root)
    -- Cube (singleton) <= that works

    I find it a bit weird to have to create a direct resources folder parent to the singletons prefabs to make it works. Why 1. doesn't work? it's inside the Resources folder. The way it seems to work is that I always need to put a "resources" folder parent to the prefab to have it spawn.

    So that would become like that which makes the folder structure way more complexe than needed:

    -<b class="Bold">Resources
    -- Prefabs
    ---Weapons
    ----resources
    -----axe01
    -----axe02
    ---Armors
    ----resources
    -----Chest01
    -----Chest02
    etc.

  • You'll see in the code I linked it need to be in a "resources" folder so it can be loaded with Resources.Load
  • I know.. But there is one resource folder already, the default one i created used by unity to be able to use Resources.Load. That is not enough?