30 lines
634 B
C#
30 lines
634 B
C#
#if !NOT_UNITY3D
|
|
|
|
using ModestTree;
|
|
using UnityEngine;
|
|
using System;
|
|
|
|
namespace Zenject
|
|
{
|
|
[NoReflectionBaking]
|
|
public class PrefabProviderCustom : IPrefabProvider
|
|
{
|
|
readonly Func<InjectContext, UnityEngine.Object> _getter;
|
|
|
|
public PrefabProviderCustom(Func<InjectContext, UnityEngine.Object> getter)
|
|
{
|
|
_getter = getter;
|
|
}
|
|
|
|
public UnityEngine.Object GetPrefab(InjectContext context)
|
|
{
|
|
var prefab = _getter(context);
|
|
Assert.That(prefab != null, "Custom prefab provider returned null");
|
|
return prefab;
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif
|
|
|