How do I instantiate if I don't have a prefab in resources folder?

Options
As thread states, I don't have a prefab in resources folder, instead, I load my gameobject in the game using unity instantiation. I instantiate different prefabs in correct positions and hierarchy into a player (imagine a robot, being made of 4 wheels, a chasis, and 2 plasma rifles).
Since I do have serialization that handles this for me, and the robot is created at runtime and later serialized, I do not have "PREFAB", I just have a gameobject that is made of prefabs, thus I can't put it in resources folder or anything like that.

Can someone help me with what I can do here?

Comments

  • Satir
    Options
    So, I'm going to sleep. Hopefully someone can let me know how to do this, otherwise I'm forced to go back to unet.
  • Tobias
    Options
    You can use Instantiate to create a player's "base character". Something that just makes sure it gets a PhotonView and sets the basis for synchronization. This can be invisible or just a dot or something.

    In addition to that, store your instantiation-config in the player Custom Properties. Here you can store and update parts that the robot is made of. Assign IDs to parts to update them.
    When the parts change, you need to run your code to update some player's robot.

    A component based "character" is interesting but we don't have a good sample for this, sorry. I hope it's part of the fun for you to figure out how to implement this.

    How did you do this in unet?
  • Satir
    Satir
    edited July 2016
    Options
    Tobias said:

    You can use Instantiate to create a player's "base character". Something that just makes sure it gets a PhotonView and sets the basis for synchronization. This can be invisible or just a dot or something.

    In addition to that, store your instantiation-config in the player Custom Properties. Here you can store and update parts that the robot is made of. Assign IDs to parts to update them.
    When the parts change, you need to run your code to update some player's robot.

    A component based "character" is interesting but we don't have a good sample for this, sorry. I hope it's part of the fun for you to figure out how to implement this.

    How did you do this in unet?

    That is quite good solution, I'm suprised I did not think of it.

    What I did in Unet was deserialize the robot upon launching the online scene, then instantiate it locally and on the server manually. In photon however I'm having some trouble doing this, but I have a plan on debugging approach which should let me do this and hopefully the future experiences with photon will be less troublesome. (Although I'm sure it's actually my skillset which is the main problem here [but that's exactly why I'm searching for networking solutions ;)]).