# When is the CheckResources() function called?

This question is asked in the context of image effect shader implementations in Unity.

Looking through the scripts for image effects in the standard assets package, I notice that initialization is generally done in the CheckResource() function.

The following is a snippet of code from the BloomAndFlares image effect.

public override bool CheckResources()
{
CheckSupport(false);

if (!isSupported)
ReportAutoDisable();
return isSupported;
}


I am probably wrong in assuming that this is essentially the Start() or Awake() functions for PoseEffectsBase, but I decided to try implementing something simillar.

public override bool CheckResources()
{

if (!isSupported)
ReportAutoDisable();
return isSupported;
}


Unlike the standard asset scripts, CheckResources() does not seem to be called consistently for me. Unity console throws UnassignedReferenceExceptions every frame, for the object saturationPassMat.

When is the CheckResources() function called? Should it be used for initialization just like Start()?

protected void Start()