How can I get asset instance
Hello.
Problem: I can't receive instance ID after adding an asset to the player.
Code example:
async function getAssetInstanceId() {
const assetId = await api.scene.addNode(path, rootNode);
...
const instanceId = await api.player.getAssetInstance({
from: getRootNode(api), // valid root node id
id: assetId, // use my model assetId
plug: ‘Null’,
property: ‘asset’,
}); // result - instanceId ==> null
}
Expected result: get valid asset instance ID
How can get it right?
Comments
4 comments
Hi Alex,
Can you try using
instead of
Let me know if this doesn't work and I will look into it further!
Marc Spencer
api.player.instanceId did not help.
Final result I want to get is to set some model properties window.api.scene.set. But instanceId is null and nothing is being set :
Alex,
Did you try following the example in this article?
https://community.threekit.com/hc/en-us/articles/4405866601243-Example-Custom-Script
I have also relayed your question to the product team and will follow up with any further information.
Thanks,
Marc
Alex
I don't think that the "from" field in your original post is necessary. You also need to make sure that your assetId is an actual node id. You can use this snippet as an example of how to get your node id.
If you make sure your assetId is the correct node id and remove the "from" parameter this should work as expected.
Thanks,
Marc
Please sign in to leave a comment.