You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In MRTK3 implement a generic component object cache. This would be a generic class with a type parameter T. The generic class should be capable is searching for type T, and cache the first found instance of T. T must derive from the Unity Component base class.
Class definition
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit
{
static class ComponentCache<T> where T : Componet
{
private static T cache = null;
public static T FindFirstInstance()
{
_ = TryFindFirstInstance(out T result);
return result;
}
public static bool TryFindFirstInstance(out T result)
{
if (cache == null)
{
cache = Object.FindFirstObjectByType<T>();
}
result = cache;
return result != null;
}
}
}
The text was updated successfully, but these errors were encountered:
This issue has been migrated a new MRTK repository, and the status of this issue will now be tracked at the following location:
Overview
In MRTK3 implement a generic component object cache. This would be a generic class with a type parameter T. The generic class should be capable is searching for type T, and cache the first found instance of T. T must derive from the Unity Component base class.
Class definition
The text was updated successfully, but these errors were encountered: