Skip to main content
Up and Coming
March 16, 2025
Solved

How can we use PropTypes.AssetArray?

Hi All,

When configuring a script's propsDefinition, I want to specify an array to hold a list of related assets. I saw the PropTypes.AssetArray type, but when I put this in my propsDefinition, I don't see any way to assign a value in the editor. 

Are the Array PropTypes not usable?

Here is the API documentation. It does not provide a lot to go on. https://developers.meta.com/horizon-worlds/reference/2.0.0/core_proptypes

Thanks!

gausroth
gausrothAnswer
Honored Contributor
March 16, 2025

Unfortunately, we cannot make arrays visible in the property panel of an object. You will have to create a private array variable and add them on start. Alternatively, you can make a big int array and add the asset ids. You can do this right where you declare it as well.

GitHub: https://github.com/Gausroth/HorizonWorldsTutorials.git Discord: https://discord.gg/hNyDQwdw4N YouTube: https://www.youtube.com/@GausRothTutorials

4 replies

gausroth
gausrothAnswer
Honored Contributor
March 16, 2025

Unfortunately, we cannot make arrays visible in the property panel of an object. You will have to create a private array variable and add them on start. Alternatively, you can make a big int array and add the asset ids. You can do this right where you declare it as well.

GitHub: https://github.com/Gausroth/HorizonWorldsTutorials.git Discord: https://discord.gg/hNyDQwdw4N YouTube: https://www.youtube.com/@GausRothTutorials
13Chris
Participant
March 17, 2025

I believe I've done an array that in the prop panel you can link all of your items. I will have to find which script I had it for but I'll put in here when I do!  I know I've done it as I didn't want to list it all out but equally I have listed things out before as I couldn't get array to work! 

SeeingBlue
Honored Contributor
March 17, 2025

Let us know if you need more help with this.

Upcoming Events : Performance Pro - UI Unleashed - Building Responsive & Performant Interfaces Thursday June 19th 5:00 PM PT - Register June Programming Calendar
Shards632
Honored Contributor
March 18, 2025

Several of the PropTypes values are 'left over' from the codeblock days. In codeblocks there were no local variables, so you had to declare everything as a property. But arrays of nullable properties would never appear in the property panel to fill in (PlayerArray, EntityArray, AssetArray).  For typescript coding, I would just forget that those array types exist. They are useless.

June Programming Calendar