SolidAlloy / GenericUnityObjects

Generic UnityEngine.Objects
Other
167 stars 13 forks source link

Warning when creating generic scriptable object #20

Closed shyam-tilt closed 3 years ago

shyam-tilt commented 3 years ago

Hi,

I am getting the following warning when creating a generic scriptable object. "The associated script that contains the generic type could not be found. Please check that its file name matches the class name." image

The variables of the class are loaded in the inspector. Should this warning be ignored?

SolidAlloy commented 3 years ago

Hi, this happens when the script associated with the GenericScriptableObject class is not named properly. You can read about the proper naming here https://github.com/SolidAlloy/GenericUnityObjects#file-naming

I don't force the naming, so you can use the scriptable object with the warning. But should the class name change, the plugin will not be able to detect this change and the references will break.

Once you apply the proper naming to the script file, the warning will disappear and you will see the file name in the Script field instead of ConcreteClass_...

shyam-tilt commented 3 years ago

Thanks for pointing this out. On checking, I found that the file name and class name were the same. But the generic scriptable object class had another non monobehaviour class. Removing and placing it in its own dedicated file removed the warning.

SolidAlloy commented 3 years ago

Thanks for the information! Was the non-MonoBehaviour class first or second in order inside the script? I will investigate and fix this behavior. Didn't know it could cause an issue

SolidAlloy commented 3 years ago

I've applied a fix for cases when there are multiple classes in one script. Could you update the package and check if the warning is absent with your original situation when you had a non-MonoBehaviour class in the script?

shyam-tilt commented 3 years ago

The non-MonoBehaviour class was first in order inside the script. But after updating to the latest version I am getting the following error in the editor. This occurs when I select any script in the editor.

image

image

SolidAlloy commented 3 years ago

Thanks, I overlooked this error. It's been fixed in the 2.10.2 version now, please check it