Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Absolute path information is required #3

Open
CaverGirl opened this issue Jan 1, 2022 · 4 comments
Open

Absolute path information is required #3

CaverGirl opened this issue Jan 1, 2022 · 4 comments

Comments

@CaverGirl
Copy link

CaverGirl commented Jan 1, 2022

It occurs when I click "Window\Delete Unused Assets\unused by editor":

arg1

ArgumentException: Absolute path information is required.
Parameter name: assemblyFile
System.Reflection.Assembly.LoadFile (System.String path, System.Security.Policy.Evidence securityEvidence) (at :0)
System.Reflection.Assembly.LoadFile (System.String path) (at :0)
AssetClean.ClassReferenceCollection.collectionAllFastspassClasses () (at Assets/Cleaner/Editor/ClassReferenceCollection.cs:244)
AssetClean.ClassReferenceCollection.CollectionFiles () (at Assets/Cleaner/Editor/ClassReferenceCollection.cs:91)
AssetClean.AssetCollector.Collection (System.String[] collectionFolders) (at Assets/Cleaner/Editor/AssetCollector.cs:59)
AssetClean.FindUnusedAssetsWindow.InitWithout () (at Assets/Cleaner/Editor/FindUnusedAssetsWindow.cs:38)

vs1

@umustbeloggedintododat
Copy link

I have this too

@Flongo28
Copy link

Just type in the full path to your libary folder, that solves the problem for me.

@WangNianyi2001
Copy link

Problem still exists.

@MatthiasPopp
Copy link

MatthiasPopp commented Jan 16, 2024

@Flongo28 is kind of right. Here is how I fixed it for me within the project without specifying an absolute path.

  1. Install the unitypackage if not done already: Rightclick on the Asset Folder in the Project View -> Import Package \ Custom Package -> select cleaner.unitypackage downloaded from this git.
  2. Locate the ClassReferenceCollection.cs at <project root dir>\Assets\Cleaner\Editor\ClassReferenceCollection.cs
  3. Change the CollectionAllClasses function. There needs to be absolute references, not relative as the LoadFile function gets a.t.m..

Here is what the function should look like:

List<System.Type> CollectionAllClasses ()
{
	List<System.Type> alltypes = new List<System.Type> ();
	string projectPath = Path.GetDirectoryName(Application.dataPath);
	string assemblyPath = Path.Combine(projectPath, "Library/ScriptAssemblies/Assembly-CSharp.dll");
	if (File.Exists(assemblyPath)) {
		alltypes.AddRange(Assembly.LoadFile(assemblyPath).GetTypes()); 
	}
	if (isSaveEditorCode)
	{
		string editorAssemblyPath = Path.Combine(projectPath, "Library/ScriptAssemblies/Assembly-CSharp-Editor.dll");

		if (File.Exists(editorAssemblyPath))
			alltypes.AddRange(Assembly.LoadFile(editorAssemblyPath).GetTypes());
	}
	return alltypes	.ToList ();
}

You may copy and overwrite your definition with the given code.

  1. If not done so, make a backup of your asset and library folder! It killed all urp shaders because i did not uncheck them in the process.

  2. Save and go back to the Editor -> Window -> Delete Unused Settings.

  3. Profit.

I do not have the time to make this a pull request. If someone does so, I would highly appreciate that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants