Quantcast
Channel: Latest Questions by aosome23
Viewing all articles
Browse latest Browse all 64

Scriptable Object and Polymorphism

$
0
0
So I have a scriptable object which has a list of BaseClass. However, there are other classes that I wrote which inherits from the BaseClass. So I decided to use Polymorphism and shove everything in that list. For a second, I thought everything was going fine... BUT, after I restarted unity, all the objects that were inherited from the base class turned into base classes. (I cant type cast it, and gives me an error "cannot cast from source type to destination type") I suspect this is a problem from serialization or a problem on how I import my objects.. This is how I import it: itemListData = (ItemDatabase)AssetDatabase.LoadAssetAtPath(currentItemListLocation, typeof(ItemDatabase)); And this is my database class public class ItemDatabase : ScriptableObject { public List itemList = new List(); }

Viewing all articles
Browse latest Browse all 64

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>