im trying to pass array of AudioClips to this script, but it wont show up in the editor. Is this the wrong AudioClip class?
You can see the old C# script that im converting to TS (it’s disabled). You can see it has a public AudioClips array that shows in editor. That’s how the new TS script should be too.
you can omit the type parameter in serializable() for strings, numbers, bools (js primitive types) and for arrays it’s the array content type (see third example above )
If you want to use codegen with audioclips you can do a little trick like this:
// declare custom AudioClip type somewhere
type AudioClip = string;
// in your script:
@serializable()
myClips : AudioClip[]; // < the component compiler will use known types, in this case it'll know AudioClip from UnityEngine.AudioClip
Ahh amazing i think that will work. Is there a certain folder assets should go in for a Needle project? I ask because when AudioClip tries to play i get this error here.
Also, i see in the web project assets folder that these assets did transfer from unity, so im a bit confused why they are not found
So there’s a way to do it without AudioSource? How’s that work? The resolveUrl stuff worked to fix those errors, but still didnt play audio. Just gave warning in console saying “failed getting sound.” - I think may be due to bug in AudioSource. Right here it uses “this.Sound” but everywhere else it uses “this.sound”