In general it helps to refer to the according API
ARCoreBackgroundRenderer (API Reference) as you said yourself is a class in the namespace GoogleARCore .. so import it via
using GoogleARCore;
or use
GoogleARCore.ARCoreBackgroundRenderer
as type in your code in UIController.
using UnityEngine;
using GoogleARCore;
namespace CompanyController
{
public class UIController : MonoBehaviour
{
// Reference this via the Inspector by drag and drop
// [SerializeField] simply allows to serialize also private fields in Unity
[SerializeField] private ARCoreBackgroundRenderer arRenderer;
// Alternatively you could as said use the type like
//[SerializeField] private GoogleARCore.ARCoreBackgroundRenderer arRenderer;
private void Awake ()
{
// As a fallback find it on the scene
if(!arRenderer) arRenderer = FindObjectOfType<ARCoreBackgroundRenderer>();
}
public void DisableARBackgroundRendering()
{
// Now use any public method of the arRenderer
arRenderer.SomePublicMethod();
}
}
}
However, you can also see that the method DisableARBackgroundRendering is private and you won't be able to use it. Also m_Camera and m_CommandBuffer are both private so you won't be able to access them.
What you can and - if you look closer into the implementation of ARBackgroundRenderer - want to do here is simply enabling and disabling the according component:
public void EnableARBackgroundRendering(bool enable)
{
arRenderer.enabled = enable;
}
since internally it will take care of the rest itself and you don't need any further access to its methods, fields and properties:
private void OnEnable()
{
if (BackgroundMaterial == null)
{
Debug.LogError("ArCameraBackground:: No material assigned.");
return;
}
LifecycleManager.Instance.OnSessionSetEnabled += _OnSessionSetEnabled;
m_Camera = GetComponent<Camera>();
m_TransitionImageTexture = Resources.Load<Texture2D>("ViewInARIcon");
BackgroundMaterial.SetTexture("_TransitionIconTex", m_TransitionImageTexture);
EnableARBackgroundRendering(); // AS YOU SEE IT ALREADY CALLS THIS ANYWAY
}
private void OnDisable()
{
LifecycleManager.Instance.OnSessionSetEnabled -= _OnSessionSetEnabled;
m_TransitionState = BackgroundTransitionState.BlackScreen;
m_CurrentStateElapsed = 0.0f;
m_Camera.ResetProjectionMatrix();
DisableARBackgroundRendering(); // AS YOU SEE IT ALREADY CALLS THIS ANYWAY
}
The type or namespace name 'ARCoreBackgroundRenderer' could not be found (are you missing a using directive or an assembly reference?)because its in another namespace.