Example #1
0
 public static void Initialize()
 {
     if (!_initialized)
     {
         Native.YGInteropSetLogger(_managedLogger);
         _initialized = true;
     }
 }
Example #2
0
        private YogaConfig(YGConfigHandle ygConfig)
        {
            _ygConfig = ygConfig;
            if (_ygConfig.IsInvalid)
            {
                throw new InvalidOperationException("Failed to allocate native memory");
            }

            _ygConfig.SetContext(this);

            if (_ygConfig == YGConfigHandle.Default)
            {
                _managedLogger = LoggerInternal;
                Native.YGInteropSetLogger(_managedLogger);
            }
        }
Example #3
0
        private YogaConfig(YGConfigHandle ygConfig)
        {
            _ygConfig = ygConfig;
            if (_ygConfig.IsInvalid)
            {
                throw new InvalidOperationException("Failed to allocate native memory");
            }

            _ygConfig.SetContext(this);

            if (_ygConfig == YGConfigHandle.Default)
            {
                _managedLogger = LoggerInternal;
#if (!UNITY_WEBGL && !UNITY_ANDROID) || UNITY_EDITOR
                Native.YGInteropSetLogger(_managedLogger);
#endif
            }
        }
Example #4
0
        public static void Initialize()
        {
            if (!_initialized)
            {
                _managedLogger = (level, message) => {
                    if (Logger != null)
                    {
                        Logger(level, message);
                    }

                    if (level == YogaLogLevel.Error)
                    {
                        throw new InvalidOperationException(message);
                    }
                };
                Native.YGInteropSetLogger(_managedLogger);
                _initialized = true;
            }
        }