I am baking link to monobehaviour prefab in this component:
public class Phantom : IComponentData
{
public VRIKSource VRIKSourcePrefab;
}
public class VRIKSource : MonoBehaviour {....}
This is authoring class:
public class PhantomAuthoring : MonoBehaviour
{
public VRIKSource VRIKSource;
class Baker : Baker<PhantomAuthoring>
{
public override void Bake(PhantomAuthoring authoring)
{
AddComponentObject(new Phantom() {VRIKSourcePrefab = authoring.VRIKSource});
AddBuffer<PhantomCommandData>();
var buffer = AddBuffer<PhantomBone>();
buffer.Length = authoring.VRIKSource.Bones.Length;
}
}
}
Everything works ok in editor, but when i build dedicated server build I get ArgumentException: The Object you want to instantiate is null. On this line of code:
foreach (var (phantom, phantomEntity) in SystemAPI.Query<Phantom>().WithNone<VRIKSolver>().WithEntityAccess())
{
var vrikSource = Object.Instantiate(phantom.VRIKSourcePrefab);
...
}
Where is my prefab in build?