Private Vector2Int roomSize = new Vector2Int(20,20) Public BlockModel.BlockType RoomGrid => RoomSettingsEditor.FromByteArray(roomGridBinary) Smart desition to save anything in bytearies and then convert it back ) Soo, i've managed to convert nested data to byte array and roll it back by accessors. In that case, how do I organize the base item classes so that I can create specific items like Weapons or Armor and save them as ScriptableObject and implement it all in a separate window as EditorGUILayout in Unity? I can refuse the idea with inherited object classes, but in this case, you lost the specificity of the created game item. Then I tried, depending on the enum ItemType, to set the needed class into Object using the following method: protected void DrawNoSerializedField(System.Object obj)įieldInfo varsArray = objType.GetFields() īut at the moment varsArray.SetValue(instance, null) Unity throws an error MissingMethodException: Default constructor not found for type WeaponModel. To save data about this item, you need to use a ScriptableObject, and here I created a variable of type Object to store all the specific classes about the game item in it: using System īut this solution is not correct for EditorGUILayout.PropertyField (), since it will draw exactly the type Object and will not allow me to add the class I need. Then, based on the base class, several classes were created for a specific type of item (such as a weapon class): using UnityEngine I started by creating a base class from which all game elements in the game are inherited: I am trying to create a tool for creating game items in Unity.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |