-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Open
Copy link
Description
Problem
RenderTargetStrategy is a MonoBehaviour, so it can't be referenced across prefabs in the inspector. This makes sharing a PooledRenderTargetStrategy between panels in different prefabs awkward — you end up needing a scene singleton and a companion component to wire things up at runtime.
Suggestion
A thin RenderTargetStrategyAsset : ScriptableObject that holds pool configuration and manages the lifetime of the underlying runtime component. RivePanel would accept one alongside the existing RenderTargetStrategy field.
[CreateAssetMenu(...)]
public class PooledRenderTargetStrategyAsset : RenderTargetStrategyAsset
{
[SerializeField] private Vector2Int m_pooledTextureSize;
[SerializeField] private int m_initialPoolSize;
[SerializeField] private int m_maxPoolSize;
private PooledRenderTargetStrategy m_runtimeInstance;
public override RenderTargetStrategy GetOrCreateStrategy(GameObject host)
{
if (m_runtimeInstance != null) return m_runtimeInstance;
var strategy = host.AddComponent<PooledRenderTargetStrategy>();
strategy.Configure(m_pooledTextureSize, m_initialPoolSize, m_maxPoolSize, ...);
m_runtimeInstance = strategy;
return strategy;
}
}The ScriptableObject stays thin — just config and a factory. The MonoBehaviour still does the actual work, so nothing about LateUpdate batching or render pipeline registration needs to change.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels