Skip to content

Application.temporaryCachePath can only be called from the main thread #408

@Draco18s

Description

@Draco18s

Describe the bug

public static async Task<string> Download(string url, bool lora = false, bool log = false, string label = null)
{
	//...
	string tmpPath = Path.Combine(tempCache, Path.GetFileName(savePath));

If this method is called on a child thread for any reason (say, I want to manage the models in the runtime and not from the editor)...

	Task t = Task.Run(async () =>
	{
		_ = await LLMManager.DownloadModel(opt.url, false, opt.text.Trim());
	});

The temp cache path will error out with a message that it can only be called from the main thread. Caching this value as a static field resolves.

Steps to reproduce

No response

LLMUnity version

No response

Operating System

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions