Improbable Icon

Pirates tutorial: Prefab change doesn't seem to propagate to final prefab


#1

Hello, I have a newb question. I’m just trying to go through the pirates tutorial. I’ve hit a few road blocks going through the tutorials and could use a couple of build/dev tips to help investigate. I’m just trying to add a component to the prefab of the player ship as per this step

However, when I add the new component, clean and export the prefabs, and then clean and build the development player, the prefab that actually gets created doesn’t seem to have the new component.

Some potential problems:

  • I’m running windows which is running Unity 5.6.0f3 (as opposed to Mac, as I ran into Unity not having the correct path there ). Has anyone succesfully completed the pirates tutorial on windows with 5.6.0f3?
  • There seem to be two player ship prefabs ( one in Assets/EntityPrefabs/PlayerShip.prefab and one in Improbable/EntityPrefabs/PlayerShip.prefab. Why are there two with the same name? I added the component to both of them after it didn’t work the first time, but still no go.

Questions: What is the final prefab that really gets spawned by SpatialOS, and where does it live and why might it not have the component that I added to it on it? I must be doing something simple wrong, but I’ve ensured the component is there, all files are saved, rebooted the computer yada yada, still no luck.

Any help would be great!

Thanks,
Curt


#3

Hi @bererton,

Great questions – sorry about the confusion. Hopefully the following explanation would help.

The prefab that you want to be modifying should be the one in Assets/EntityPrefabs.

To answer your question, you will find the section of the docs that explains how local vs streaming asset databases work with SpatialOS and Unity.

But to give a quick overview:

  • What happens when you perform the “Export All EntityPrefabs” step is that, each prefab gets exported as an asset bundle into the build\assembly\unity folder of your SpatialOS project.
  • These asset bundles are for each individual prefab. They are then dynamically loaded when the time comes to instantiate a game object from a given prefab.

Thanks for troubleshooting – the fact that it isn’t clear what is happening is actually our fault, not yours – so let’s try to help you figure it out.

When you say that prefab actually gets created but doesn’t seem to have the new component, as you seeing this new prefab being instantiate in the Unity Editor (i.e., as a client) ? What I suggest is making sure that:

  • your build/assemby/untiy folder is definitely empty when you perform a “Clean all entity prefabs”
  • that you are definitely APPLYING any changes and saving them to the prefab (sometimes I forget to Apply the changs after modifying a prefab as a game object within the scene).
  • that after you perform a “Export all entity prefabs” that you see your prefab there.

#4

Hi Chong-U,
Thanks for your reply and help. Unfortunately, I’ve decided to put my
research into SpatialOS on hold for now. I’ll try to finish the tutorial in
my spare time and see if this entity is actually being created with the new
component or not. It may also be a Unity bug as I was having issues even
adding the new component at all, though that did seem to work before I had
this other issue.

I’ll let you know if I make progress.

Thanks,
Curt