Look at how sounds are handled for an example of how to do this. The PR for particles also works like sounds if you want to see an exact diff of how to do it.