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

Error opening Creator Window #30

Closed
tkyleharrison opened this issue Jan 13, 2020 · 11 comments
Closed

Error opening Creator Window #30

tkyleharrison opened this issue Jan 13, 2020 · 11 comments

Comments

@tkyleharrison
Copy link

We installed Deform as a package in both Unity 2019.2 and 2019.3. The Creator Window says "No deformers found." and throws an exception:

ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
System.Reflection.Assembly.GetTypes () (at <437ba245d8404784b9fbab9b439ac908>:0)
DeformEditor.CreatorWindow+d__18.MoveNext () (at Library/PackageCache/com.beans.deform@5c7ccda4236aec3ff1e7ada04879bca945eba466/Code/Editor/CreatorWindow.cs:317)
System.Collections.Generic.EnumerableHelpers.ToArray[T] (System.Collections.Generic.IEnumerable1[T] source, System.Int32& length) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0) System.Linq.Buffer1[TElement]..ctor (System.Collections.Generic.IEnumerable1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0) System.Linq.OrderedEnumerable1[TElement].ToArray () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Buffer1[TElement]..ctor (System.Collections.Generic.IEnumerable1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.OrderedEnumerable1[TElement].ToList () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0) System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
DeformEditor.CreatorWindow.UpdateDeformerAttributes () (at Library/PackageCache/com.beans.deform@5c7ccda4236aec3ff1e7ada04879bca945eba466/Code/Editor/CreatorWindow.cs:62)
DeformEditor.CreatorWindow.OnEnable () (at Library/PackageCache/com.beans.deform@5c7ccda4236aec3ff1e7ada04879bca945eba466/Code/Editor/CreatorWindow.cs:69)
UnityEditor.EditorWindow:GetWindow(String, Boolean)
DeformEditor.CreatorWindow:ShowWindow() (at Library/PackageCache/com.beans.deform@5c7ccda4236aec3ff1e7ada04879bca945eba466/Code/Editor/CreatorWindow.cs:56)

@keenanwoodall
Copy link
Owner

Sorry to hear that! I'll do my best to get to the bottom of it. Can you walk me through the exact steps you took to install Deform?

@tkyleharrison
Copy link
Author

All I did was add this line to manifest.json:
"com.beans.deform": "https://github.com/keenanwoodall/Deform.git",

@tkyleharrison
Copy link
Author

I'm able to add the various deform components to objects manually and it works. So far the UI is the only issue I'm seeing.

@keenanwoodall
Copy link
Owner

Thanks for the info. I'll see if I can reproduce the error when I get home from work. What were the exact version numbers of Unity that you used?

@tkyleharrison
Copy link
Author

I'm using 2019.3.0f3. I also tried it on 2019.2.6f1 with the same error. Thanks for looking into it!

@keenanwoodall
Copy link
Owner

keenanwoodall commented Jan 14, 2020

Hmmm I made new projects on both versions of Unity, installed Deform as a package via the manifest file and was able to open and use the Creator Window without any issues.

It appears the exception that's getting thrown on your end happens when classes in a module cannot be loaded. I'm not sure why this is happening for you though.

Here's the things I'd recommend trying (some of which you may have tried already):

  • Change the Api Compatibility Level in your Project Settings
  • Change the Scripting Backend in your Project Settings
  • Uninstall/reinstall Deform
  • Restart the Editor
  • Restart the computer
  • Run Unity as Administrator
  • Install Deform in a blank project
  • Install Deform in a blank project on a different computer
  • Install Deform in 2019.2.17 (the latest official release at the time of this post)

If nothing changes after trying these things, try cloning the repo into your Packages folder (after removing it from the manifest), opening the CreatorWindow.cs file and pasting these two methods over the GetAllDeformerAttributes() method at the end of the file.

public static IEnumerable<DeformerAttribute> GetAllDeformerAttributes ()
{
	var assemblies = AppDomain.CurrentDomain.GetAssemblies ();
	foreach (var assembly in assemblies)
	{
		foreach (var type in GetLoadableTypes (assembly))
		{
			if (type.IsSubclassOf (typeof (Deformer)))
			{
				var attribute = type.GetCustomAttribute<DeformerAttribute> (false);
				if (attribute != null)
					yield return attribute;
			}
		}
	}
}

public static IEnumerable<Type> GetLoadableTypes(Assembly assembly)
{
	try
	{
		return assembly.GetTypes();
	}
	catch (ReflectionTypeLoadException e)
	{
		return e.Types.Where(t => t != null);
	}
}

I have no idea if it will fix anything since I cannot reproduce the error, but it's the best I can do.

If the error still persists I'm not sure I can do anything further without you sending me a repro. Apologies for the trouble this is causing you, but hopefully we can find a fix!

@tkyleharrison
Copy link
Author

We use unity assembly definitions to split our project into multiple assemblies. I suspect the issue is related to how we divide it up, but your change to CreatorWindow.cs fixed it!

Any chance this change will make it into the main branch? That would allow us to switch back to the package version :)

Thanks for your help!

@keenanwoodall
Copy link
Owner

I'm glad it worked! I'll try and make a new release today. Does it look like all the deformers are present in the Creator Window?

@tkyleharrison
Copy link
Author

Yea, it's a long list with Normal, Noise, Mask and Utility sections. All the deformers I've tested are working.

The only minor issue I've noticed it Create Deformable comes in with a pink material since I'm using URP. Easy enough to swap out the material.

Thanks again for your help!

@keenanwoodall
Copy link
Owner

keenanwoodall commented Jan 14, 2020

I created another issue to look into allowing the user to change the default material here #31. If it's cloned into your Packages folder you can change it (I think), but I'm not so sure if it'll work if Deform is installed via git url in the manifest.

@keenanwoodall
Copy link
Owner

Creator Window fix is in the newest release/on the master branch.

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

2 participants