Referencing Collections

This may be a silly question, but is there a way to get a reference to a Collection (of primitives, billboards, entities, etc) that is added to scene.primitives without passing a reference?

To correct this, I meant a reference to an instance within a collection.

I think this post has an example of what you are looking for https://groups.google.com/d/msg/cesium-dev/H0QS6wD_4YI/mG845jDlFAMJ

You just need to store the primitives/geometries/entities as you create them. Then you can reference them by whichever method you stored them as you created them.

Thanks for the response. Sadly, that doesn’t solve my issue because you’re passing a reference to a Collection which you get when you create it. I can’t pass a reference as the code that accesses the collection/primitive, can’t see the code that creates it. I need something more along the lines of PrimitiveCollection.getById(“String”) like in EntityCollection, but for PrimitiveCollection.

I also would need to be able to set that id, since the one for entityCollection changes every time the page is loaded.

That random one for entity collection is a GUID. You would want to use its instance ID instead, which can be consistent between application loads if set so during entity creation.

Is it possible to share a sample of the data source that is generating your primitivesCollection? You can send it to me privately if need be.