I can successfully load a custom ShaderGraphMaterial material loaded from a .usda file created with Reality Composer
var shotTrailMaterial : ShaderGraphMaterial? = nil
do {
...
let materialData = try Data(contentsOf: materialURL)
shotTrailMaterial = try await ShaderGraphMaterial(named:"/Root/Material",
from: materialData)
} catch { ... }
for which I can set the "fractionOpaque" custom property to a floating point value
try shotTrailMaterial.setParameter(name: "fractionOpaque", value: .float(0.9))
The above works well for the entities I create with this material. Now I would like to animate the material based on this parameter but the following fails:
let anim = FromToByAnimation<Float>(name: "foo",
from: 0.0,
to: 1.0,
duration: 3.0,
bindTarget: .parameter("fractionOpaque"))
if let animResource = try? AnimationResource.generate(with: anim) {
entity.playAnimation(animResource, transitionDuration: 3.0, startsPaused: false)
}
I get the error
Cannot find a BindPoint for any bind path: "KeyValue.keyValueStore[fractionOpaque]"
Clearly my key path is wrong for the bindTarget: parameter. I want to set the "fractionOpaque" property on material 0, but I am not sure what the correct path for this is? This is a Vision OS app.