Hey guys, Im trying to attach the SSAO script to my camera, if I drag it onto the camera it works fine. But when I try to make a script attach it to the camera I get the error
“Object reference not set to an instance of an object UnityStandardAssets.ImageEffects.ScreenSpaceAmbientOcclusion.CreateMaterials () (at Assets/Plugins/ImageEffects/Scripts/ScreenSpaceAmbientOcclusion)”
private void CreateMaterials ()
{
if (!m_SSAOMaterial && m_SSAOShader.isSupported)
{
m_SSAOMaterial = CreateMaterial (m_SSAOShader);
m_SSAOMaterial.SetTexture ("_RandomTexture", m_RandomTexture);
}
}
the “if(!m_SSAOMaterial && M_SSAOShader.isSupported)” is the line that the error goes to when i double click on it in the console
When looking at the script after its been attached to the camera through my script the “SSAO Shader” and “Random Texture” are empty. and the script is turned off. I tried attaching the shader and texture to it manually but still couldn’t turn it on.
I also tried making a camera prefab and then instantiate with the SSAO script on and it still didn’t work
Hopefully someone can help me out
Thanks in advance ![]()