This is the Awake() function in XRBaseInteractable:
protected virtual void Awake()
{
// If no colliders were set, populate with children colliders
if (m_Colliders.Count == 0)
{
GetComponentsInChildren(m_Colliders);
// Skip any that are trigger colliders since these are usually associated with snap volumes.
// If a user wants to use a trigger collider, they must serialize the reference manually.
m_Colliders.RemoveAll(col => col.isTrigger);
}
// Setup the starting filters
m_HoverFilters.RegisterReferences(m_StartingHoverFilters, this);
m_SelectFilters.RegisterReferences(m_StartingSelectFilters, this);
m_InteractionStrengthFilters.RegisterReferences(m_StartingInteractionStrengthFilters, this);
// Setup Interaction Manager
FindCreateInteractionManager();
}
Awake shouldn’t be doing stuff like finding and creating stuff. This breaks multi-scene setups where InteractionManagers get created in the wrong scene (despite another scene having one but hadn’t loaded/awaken yet)
What’s frustrating about this is because XRBaseInteractable is a base class for all interactables, this forces us to pull the package into our project so we can remove this line from the code. (It was either that, or find multiple instances of InteractionManager and destroy the ones we don’t want then fix up interactables to point at the correct interaction manager)
Please test XRI in multi-scene setups where you might have one scene for persistent stuff such as the XR rig and Interaction Manager, and another scene for content or game level stuff that has interactables.