コード例 #1
0
        protected virtual void Awake()
        {
            // pin this object in the GC
            thisObject = GCHandle.Alloc(this, GCHandleType.Normal);

            renderFuncPtr = Wrapper.GetRenderEventFunc();
        }
コード例 #2
0
        protected virtual void Awake()
        {
            // pin callback
            stateChangedCallback = (args) =>
            {
#if UNITY_WSA_10_0
                if (!UnityEngine.WSA.Application.RunningOnAppThread())
                {
                    UnityEngine.WSA.Application.InvokeOnAppThread(() =>
                    {
                        QueueCallback(() => { OnStateChanged(args); });
                    }, false);
                }
                else
                {
                    QueueCallback(() => { OnStateChanged(args); });
                }
#else
                // there is still a chance the callback is on a non AppThread(callbacks genereated from WaitForEndOfFrame are not)
                // this will process the callback on AppThread on a FixedUpdate
                QueueCallback(() => { OnStateChanged(args); });
#endif
            };

            renderFuncPtr  = Wrapper.GetRenderEventFunc();
            callbackHandle = GCHandle.Alloc(stateChangedCallback);
        }
コード例 #3
0
        protected virtual void Awake()
        {
            // define callback function
            stateChangedCallback = new Wrapper.StateChangedCallback(CallbackWrapper.Capture_Callback);

            // pin this object in the GC
            thisObject = GCHandle.Alloc(this, GCHandleType.Normal);

            renderFuncPtr = Wrapper.GetRenderEventFunc();
        }