Resources Path Handling

Options
erre
erre
Hi,

in our game we have many items which needs to be instantiated with PhotonNetwork.InstantiateSceneObject().

So, I have a curiosity... What is the best way to handle resources path in order to using them in this function? I mean, we have a kind of item database and we can ask him the object prefab (and so the prefab name), but unfortunately we can't know the prefab path.

Have you ever think a easy solution for this? We prefer to handle this in some way without hard-coded path.

Sorry for strange question.

Thanks you for attention.

Andrea.

Comments

  • vadim
    Options
    Resource name is the path to resource folder relative to (any) Resources folder inside the Assets folder of your project (according to http://docs.unity3d.com/ScriptReference/Resources.Load.html)
    So it's not clear how you can get only name but not path.
  • erre
    Options
    My problem was: if I have a set of items under "Resources/Items/PickableItems/", how can I handle this situation in order to not hard code in my script the path "Items/PickableItems" + itemName? I wouldn' t modify my code if the position of item change in my project (remain under Resources).

    I resolved this with a custom inspector but my question was about a common solution for this (if there is).

    Anyway, Thank you for attention :)

    Andrea.
  • vadim
    Options
    I think this is Unity problem, not PUN's, if problem at all. As I said, in Unity terms, resource name is Items/PickableItems/itemName. I doubt that Unity resource system designed to support moving things inside Resource folder freely.