Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question AudioClip variables, how are they stored?

Discussion in 'Scripting' started by lo-94, Jun 1, 2023.

  1. lo-94

    lo-94

    Joined:
    Nov 1, 2013
    Posts:
    282
    Hey all,

    I just realized that when it comes to AudioClip variables on scripts, I don't know how they are stored. Is this simply a reference to the AudioClip location and it isn't loaded/decompressed until passed into an AudioSource for decoding? I'm assuming that if you have multiple scripts with duplicate AudioClips, those aren't going to be separate instances
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
    It's like any other asset. Dragging a reference in just makes a magic link... 57 magic links still can point to the same asset.

    As to "is it loaded/decompressed or not" that is 100% up to the import settings on the audio: streamed, preloaded, etc