Files
tianrunCRM/Assets/3rd/NativeCamera/Plugins/Android/NCCallbackHelper.cs

31 lines
529 B
C#
Raw Normal View History

2020-07-18 21:12:14 +08:00
#if !UNITY_EDITOR && UNITY_ANDROID
using UnityEngine;
namespace NativeCameraNamespace
{
public class NCCallbackHelper : MonoBehaviour
{
private System.Action mainThreadAction = null;
private void Awake()
{
DontDestroyOnLoad( gameObject );
}
private void Update()
{
if( mainThreadAction != null )
{
System.Action temp = mainThreadAction;
mainThreadAction = null;
temp();
}
}
public void CallOnMainThread( System.Action function )
{
mainThreadAction = function;
}
}
}
2020-07-04 14:41:25 +08:00
#endif