Exemple #1
0
        private void Awake()
        {
            if (string.IsNullOrEmpty(_nativeClassName))
            {
                Destroy(this);
                return;
            }

            NativeMonoBehaviourBridge bridge = this;

            _managedPointer = ReflectionHelpers.AllocObjectPtr(bridge);

            _nativeInstance = NativeMethods.createNativeMonoBehaviour.Invoke(_nativeClassName, _managedPointer);
            if (_nativeInstance == IntPtr.Zero)
            {
                Destroy(this);
                return;
            }

            NativeMethods.monoBehaviourAwake.Invoke(_nativeInstance);
        }