You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
[DidReloadScripts] Argument Exception: assemblyString cannot have zero length #39
I've just installed this through the package manager and it shows this error when I Try to use the Creatable attribute or [CreateGenericAssetMenu]. It doesn't let me create anything, my Create dropdown menu doesn't show the generic scriptable objects
This seems to be caused by the following function:
/// <summary>Returns the assembly name of the class implemented by this script.</summary>/// <param name="script">The script to search for assembly in.</param>/// <returns>/// The assembly name without the .dll extension, or an empty string if the assembly was not found./// </returns>[PublicAPI,NotNull]publicstaticstringGetAssemblyName(thisMonoScriptscript){stringassemblyName=script.Internal_GetAssemblyName();intlastDotIndex=assemblyName.LastIndexOf('.');return/* Here >> */lastDotIndex==-1/* << */?string.Empty:assemblyName.Substring(0,lastDotIndex);}
Copy 'Library\PackageCache\com.solidalloy.util@[VERSION HERE]' to 'Packages' and remove the '@[VERSION HERE]'
Using the one moved to Packages, edit 'MonoScriptExtensions.cs' replacing the original 'GetAssemblyName(...)' with the fix below:
Repeat the above of moving the package to 'Packages' for 'com.solidalloy.type-references@[VERSION HERE]' and 'com.solidalloy.generic-unity-objects@[VERSION HERE]', make sure to remove '@[VERSION HERE]' once moved.
Next, to fix an error with the popup menu, change '_closeButtonStyle' value, from 'GUIHelper.cs' in 'com.solidalloy.util', to 'EditorStyles.toolbarTextField' and reference UnityEditor. (See #10)
Go to 'MonoScriptExtensions.cs' and change 'GetClassType' to:
[PublicAPI,CanBeNull]publicstaticTypeGetClassType(thisMonoScriptscript,Type_type,stringclassName=null){TypesimpleType=script.GetClass();if(simpleType!=null)returnsimpleType;stringfoundClassName=string.IsNullOrEmpty(className)?GetFirstClassFromText(script.text):GetFirstClassWithName(script.text,className);if(string.IsNullOrEmpty(foundClassName))returnnull;//string assemblyName = script.GetAssemblyName();stringassemblyName=_type.GetShortAssemblyName();Assemblyassembly;try{assembly=Assembly.Load(assemblyName);}catch(Exceptione){// Whatever caused this exception, the type cannot be loaded, so disregard it as null.if(eisFileNotFoundException||eisFileLoadException)returnnull;throw;}stringnamespaceName=script.GetNamespaceName();stringfullTypeName=namespaceName==string.Empty?foundClassName:$"{namespaceName}.{foundClassName}";Typetype=assembly.GetType(fullTypeName);returntype;}
After, in 'TypeReferenceEditor.cs' in ''TryUpdatingTypeUsingGUID' add Type classType = AssetDatabase.GetMainAssetTypeFromGUID(new GUID(GUID));
before var type = script.GetClassType();
and in 'script.GetClassType' ass to the args 'classType'
Will look like: var type = script.GetClassType(classType);
In 'AssetHelper.cs' at 'GetAssetDetails' replace with:
Activity
orkuncinfer commentedon Mar 13, 2024
also having this issue
JevinLevin commentedon Sep 13, 2024
Same here, I assume its broken in recent versions sadly
12Acorns commentedon Oct 9, 2024
This seems to be caused by the following function:
I think it needs to be:
It seems the author assumed that if the dot index is -1 then the assembly is null.
12Acorns commentedon Oct 9, 2024
##Temporary fix##
Follow this: https://docs.unity3d.com/Manual/upm-embed.html
Copy 'Library\PackageCache\com.solidalloy.util@[VERSION HERE]' to 'Packages' and remove the '@[VERSION HERE]'
Using the one moved to Packages, edit 'MonoScriptExtensions.cs' replacing the original 'GetAssemblyName(...)' with the fix below:
Repeat the above of moving the package to 'Packages' for 'com.solidalloy.type-references@[VERSION HERE]' and 'com.solidalloy.generic-unity-objects@[VERSION HERE]', make sure to remove '@[VERSION HERE]' once moved.
Next, to fix an error with the popup menu, change '_closeButtonStyle' value, from 'GUIHelper.cs' in 'com.solidalloy.util', to 'EditorStyles.toolbarTextField' and reference UnityEditor. (See #10)
Go to 'MonoScriptExtensions.cs' and change 'GetClassType' to:
After, in 'TypeReferenceEditor.cs' in ''TryUpdatingTypeUsingGUID' add
Type classType = AssetDatabase.GetMainAssetTypeFromGUID(new GUID(GUID));before
var type = script.GetClassType();and in 'script.GetClassType' ass to the args 'classType'
Will look like:
var type = script.GetClassType(classType);In 'AssetHelper.cs' at 'GetAssetDetails' replace with:
In 'TypeInfo.cs' replace 'TypeAtGUIDSame' with:
That should be it.
Fixed giving null assembly name when assembly is present.
Oxydiz commentedon Oct 19, 2024
Thank you so much 12Acorns, that was truly helpful !
If someone else encounters this issue, in addition to the changes above I also had to modify a couple more files:
Apply Fixes from SolidAlloy/GenericUnityObjects#39
Apply fixes from SolidAlloy/GenericUnityObjects#39
Apply Fixes from SolidAlloy#39
Fixes from SolidAlloy/GenericUnityObjects#39
Fixes from SolidAlloy#39
Fixes from SolidAlloy/GenericUnityObjects#39