Hi,
Here is the issue i'm facing :
public class Shapes : ScriptableObject {
GetShape(){}
}
[CreateAssetMenu(fileName = "Quad",menuName = "Shapes/Quad")]
[System.Serializable]
public class Quad : Shapes {}
[CreateAssetMenu(fileName = "Star",menuName = "Shapes/Star")]
[System.Serializable]
public class Star : Shapes {}
This is all in the same file.
Creating the assets works fine, but when i restart the editor or leave play, they do not get reloaded properly, that is because the script file associated to the scriptableObject asset is not set.
In the Yaml you find : m_Script: {fileID: 0}
m_Script: {fileID: 0}
instead of normally : m_Script: {fileID: 11500000, guid: e9c59ec9df3a4c942919c13d32e8cd99, type: 3}
m_Script: {fileID: 11500000, guid: e9c59ec9df3a4c942919c13d32e8cd99, type: 3}
Which appears correctly if those classes are in separated files.
I have 5 or 6 different base shapes, some shapes instanciators etc... I do not want to put them in different files, it is bad for my code flow, as i have a better view and understanding of the class hierarchy by having them all defined in the same file.
To go further is there any project for Unity to actually dissociate the meta of the serialized classes and prefabs from their script file GUID? and instead associate it to a GUID of the class itself? (like the class inheritance hierarchy that you can find here : m_EditorClassIdentifier: Assembly-CSharp::Star)
m_EditorClassIdentifier: Assembly-CSharp::Star
Why is it that Unity still links the script file to anything editor related, that makes inheritance very cumbersome...
Edit : If i correct the YAML by hand then it works and reload properly but i cannot fix the YAML by hand for any number of instances... that is a hack, if someone knows a solution to actually edit the .asset file by code when the object is created and fix this issue that would be great.
Furthermore, i use the GUID of the script where i defined the "Shapes" class but for any other configuration the GUID would be different.
It is a great limitation that Unity relies on the File names and Files GUIDs for the logic.
And also, if the editor serialize to text option is not set then i find myself with a binary and cannot fix that issue.
Any suggestions?
If you have found out something about this that will be.
Inheriting Parent Rotation and position
2
Answers
Inheritance Implementation Weapon add System for the Pro Military: FPS Character?
0
Answers
I need to make two bullet controllers (friendly and enemy) Should I inherit?
1
Answer
Inheritance and Component Types in C#
2
Answers
When or where do I set a prefab script subclass property?
2
Answers