Version: Unity 6.3 Beta (6000.3)
LanguageEnglish
  • C#
Removed

AvailableData

struct in UnityEngine.Audio

/

Implemented in:UnityEngine.AudioModule

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Obsolete Types with embedded references are not supported in this version of your compiler.

Description

A temporary collection of data available for enumeration.

You can enumerate the Elements within using a foreach loop over this collection.

Additional resources: ControlContext.SendData, ReturnDataContext.SendData.

struct ThingToCommunicate
{
    public float MyData;
}
struct OtherThing
{
    public int MyOtherData;
}
public void DataAvailable(DataAvailableContext context)
{
    float myData = 0f;
    foreach(var element in context.GetAvailableData())
    {
        if (element.TryGetData(out ThingToCommunicate thing))
        {
            myData = thing.MyData;
        }
        else if (element.TryGetData(out OtherThing otherThing))
        {
            myData = MathF.PI * otherThing.MyOtherData;
        }
    }
}

Above example illustrates the pattern of how to enumerate ProcessorAvailableData, for instance from within Processor.IProcessor.DataAvailable or IProcessorControl.Update.