# Type of constraints that reference

AnyParameterReference and ComponentParameterReference can constrain referencing types by specifying attributes.

## Example script

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    using UnityEngine;
    using Arbor;

    [AddComponentMenu("")]
    public class TestConstraintReferenceBehaviour : StateBehaviour
    {
    	[ClassExtends(typeof(AudioSource))]
    	public ComponentParameterReference audioSource = new ComponentParameterReference();

    	[ClassExtends(typeof(AudioClip))]
    	public AssetObjectParameterReference audioClip = new AssetObjectParameterReference();

    	// Use this for enter state
    	public override void OnStateBegin()
    	{
    		AudioSource source = audioSource.value as AudioSource;

    		if (source != null)
    		{
    			source.clip = audioClip.value as AudioClip;
    		}
    	}
    }

Example of adding a script

Example ParameterContainer

## Examples of available attributes

Target type | Attributes
--- | ---
ComponentParameterReference | Class derived from ClassTypeConstraintAttribute SlotTypeAttribute It is also constrained to the Component class.
AssetObjectParameterReference | Class derived from ClassTypeConstraintAttribute SlotTypeAttribute It is also constrained to the asset object type.