private StreamingTexture CreateStreamingTexture(Texture obj, ref ImageDescription imageDescription, ref ContentStorageHeader storageHeader)
        {
            // Get content storage container
            var storage = ContentStreaming.GetStorage(ref storageHeader);

            if (storage == null)
            {
                throw new ContentStreamingException("Missing content storage.");
            }

            // Find resource or create new
            var resource = Get(obj);

            if (resource == null)
            {
                resource = new StreamingTexture(this, obj);
                RegisterResource(resource);
            }

            // Update resource storage/description information (may be modified on asset rebuilding)
            resource.Init(Services.GetSafeServiceAs <IDatabaseFileProviderService>(), storage, ref imageDescription);

            // Check if cannot use streaming
            if (!Enabled)
            {
                FullyLoadResource(resource);
            }

            return(resource);
        }
        private void SetResourceStreamingOptions(StreamingTexture resource, StreamingOptions options, bool combineOptions)
        {
            var alreadyHasOptions = resource.StreamingOptions.HasValue;
            var newOptions        = combineOptions && alreadyHasOptions?options.CombineWith(resource.StreamingOptions.Value) : options;

            resource.StreamingOptions = newOptions;

            if (newOptions.LoadImmediately)
            {
                // ensure that the resource is not currently streaming
                if (!resource.CanBeUpdated)
                {
                    resource.StopStreaming();
                    FlushSync();
                }

                // Stream resource to the maximum level
                FullyLoadResource(resource);
            }
        }