Unity Asset

"Class Field Editor" is an Unity asset, implemented in the language of C#. The main task is to view and edit the fields of the class - the heir to MonoBehaviour in PlayMode mode. An additional option is the ability to save and download class field values using the JSON format.
The package presents an asset and an example of its use. Asset is a set of scripts, prefabs.

General scheme of "Class Field Editor" package:

  • Scenes contains a scene with an example of the use of the Class Field Editor;

  • ExampleClasses contains the ExampleClass1.cs and ExampleClass2.cs;

  • Resources contains prefabs;

  • Scripts contains C# scripts.

Class Field Editor 1.png

General scheme prefab dependences

The main prefab is ClassFieldEditor.prefab. The object is created and placed on the scene using the command in the Unity Editor: "GameObjects -> UI -> Class Field Editor ". Prefab includes a component ClassFieldEditorScript(Script), which is used to control all other prefabs ClassFieldEditor.prefab their objects.

Inspector Tab: Sat Inspector Script(Script) in SatInspector.prefab

  1. ClassFieldEditor can save the following types of fields:

  2. String

  3. Float

  4. Vector2

  5. Vector3

  6. Boolean

  7. List<float> 

  8. List<string>

  9. Int

Снимок экрана 2021-05-26 222521.png


This is the main prefab. It is placed on stage with the help of the GameObjects team->UI->Class Field Editor. The prefab includes the ClassFieldEditorScript(Script) component, which manages DataField, LoadPanel, SavePanel, and other object settings.


The creation of this prefab is controlled by the ClassFieldEditor (Script) component in The ClassFieldEditor.prefab. It contains GameObjects: Dropdown - selects a downloadable file with field values for a particular class.


The creation of this prefab is controlled by the ClassFieldEditorScript(Script) component in the ClassFieldEditor.prefab. This auxiliary prefab is designed to create a basic class field visualization table using objects: 

  • InputField_x1 - used for string, float, List types; 

  • InputField_v2 is used for Vector2 type; 

  • InputField_v3 is used for Vector3 type; 

  • Toggle_bool is used for bool type.


The creation of this prefab is controlled by the ClassFieldEditor (Script) component in the ClassFieldEditor prefab. Prefab is GameObjects: Button and Text - saves jSON field values.

Class Field Editor 2.png

General scheme of scripts

  1. ClassFieldEditorScript.cs and CFE_editor.cs. The script is a component of the ClassFieldEditor.prefab prefab. Designed to create and control all objects that depend on it.

  • Custom Class is a class (MonoBehaviour) where the fields appear in the table, and it must be initialized by dragging it to work properly;

  •  Save File Extension is an extension of the JSON file that stores the value of the class fields;

  • Caption List - field names for the convenience of table design; 

  • No Caption String - Unless the name of the field in the Caption List is specified, this value is set;

2. DataFieldScript.cs and DataPanelScript.cs 

The scripts is a components of dataField and DataPanel, and is designed to create table elements that match the class field.

3. InpFieldScript.cs 

The script controls the components of the "TMP_InputField." Designed to make it easier to visualize data editing.

4. LoadPanelScript.cs and SavePanelScript.cs.

The scripts are components of LoadPanel.prefab and SavePanel.prefab. They are used to save and load the class fields.