getGeometryInstanceAttributes is not a function - Error

1. A concise explanation of the problem you’re experiencing.

Hi everyone,

I have an issue with using “getGeometryInstanceAttributes”.
When I try to use getGeometryInstanceAttributes, I get an error that "getGeometryInstanceAttributes is not a function "
This a part of the code:

var load = function(viewer, callback) {

var cubes;
req.onload = function(evt) {

that.primitive = new Cesium.PrimitiveCollection({show:true, destroyPrimitives:true});

callback(viewer, that.primitive , this.number_cube);


function callBackFunc (viewer, myPrimitive, cubes) {

var i = 0;
var color = myPrimitive.getGeometryInstanceAttributes(i).color; // ERROR: myPrimitive.getGeometryInstanceAttributes is not a function
color[3] = (Math.cos(counter) * 0.5 + 0.5) * 255;
myPrimitive.getGeometryInstanceAttributes(i).color = color;

I really appreciate your help.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

4. The Cesium version you’re using, your operating system and browser.

Hey Maryam,

Notice that a PrimitiveCollection ( is not the same as a Primitive ( A Primitive has a method getGeometryInstanceAttributes while PrimitiveCollection does not.

When you add a primitive, it returns the primitive that was added (see So you should call getGeometryInstanceAttributes on that instead.

Does that make sense?