Forum Discussion

andrewtek's avatar
andrewtek
Member
9 months ago
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!

  • 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.

4 Replies

  • 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.

    • 13_Chris's avatar
      13_Chris
      Partner

      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! 

  • 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.