Attaching a prefab to a parent entity?
I can create and spawn a wooden box from the prefab without a problem, but I'm unable to correctly attach it to another object. In this case I'm trying to make a MiniCopter the parent of the box. I've tried many things including what the Unity documentation says, basically the following:
var obj = GameManager.server.CreatePrefab("assets/prefabs/deployable/woodenbox/woodbox_deployed.prefab");
obj.transform.SetParent(miniCopter.gameObject.transform);
var ent = obj.GetComponent<BaseEntity>();
ent.Spawn();​

It seems to work in the sense that If I log the position of the box, and the minicopter, the box's position does follow the minicopter's as it moves, but I can't see or interact with the box. It seems like this should defnitely be possible, but I'm just missing something.

Does anyone know the solution?
I figured it out.
var obj = GameManager.server.CreatePrefab("assets/prefabs/deployable/woodenbox/woodbox_deployed.prefab");
var ent = obj.GetComponent<BaseEntity>();
ent.SetParent(miniCopter);
ent.Spawn();​​


Merged post

So now I have another issue. The model for the box sometimes dissapears or stays frozen in midair, although the box still works where it should be on the minicopter. I thing the server just isn't sending position updates for the box often enough, which makes sense, because normally they don't move. Does anyone know how to change the networking behavior?
Not sure, but I think child entities are updated while the parent is updated, no matter which type are they.
andrew2085
So now I have another issue. The model for the box sometimes dissapears or stays frozen in midair, although the box still works where it should be on the minicopter. I thing the server just isn't sending position updates for the box often enough, which makes sense, because normally they don't move. Does anyone know how to change the networking behavior?

I ran into a similar problem when attaching certain items to cars.  Occasionally they would seem to detach from the car and not update their position.  Never did find a fix for it, but maybe it is possible.  Perhaps with some code in the minicopter's FixedUpdate.

yes you think correctly use plugin for better helicopter and also has a box which after a while disappears and lags behind :-(