#Instantiating from Prefab Array

1 messages · Page 1 of 1 (latest)

stone pewter
#

Hi everyone, I am new here.
I am trying for a while now to instantiate a random object from an array (from a Job within ISystem).
A bit of background: I was able to have an IComponent with an Entity propery, than the Authoring Component used GetEntity on a regular GameObject reference, and set it the the IComponent. Than I had a Job instantiate a copy of that every half a second. That worked perfectly.
Now I am trying to have a Prefab array, and every time the system needs to Instantiate a prefab, It will get one at random from that list.

I have tried to create a BlobAssetReference<BlobArray<Entity>> from the original GameObject array, but when I instantiate it, I get an empty Entity... I tried using NativeArray but I get an error about the component "Blittable component type contains a pointer" or something like that.

Any ideas?
Thanks!

teal dew
#

Only normal components and dynamic buffers can hold references of entities from baking