Enttity.EntityData not taking custom object but will take string, int, etc

I have a simple object ID, as seen below. I have assigned a string, int, and other simple objects and I am able to see the EntityData, as expected, when the user selects a given entity. However, when the entity is selected and the someEntity.EntityData is set to an instance of ID (or another custom object) the EntityData, as seen in Figure 3. 

 

EntityData is of type Object so I am not sure why a custom object would not work. This seems analogous to the commonly used Tag to store some generic object. 


Maybe I am missing something simple but any help to understand how to (or why it not allowed) save a custom object in the EnityData variable.

Figure 1: Setting to ID object

Figure 2: Structure of the ID object.

 

Figure 3: selected Entity ent.EntityData is null.

 

 

0

Comments

3 comments
Date Votes
  • Just in case anyone runs into this issue... the answer was right in front of my face: ID needs to implement ICloneable.

    0
  • No it does not need to be IClonable to work. I use EntityData everywhere with custom classes and never had such issue. You are doing something else in your code that clear the EntityData. The only issue a custom class has when assigned to an EntityData is that it is not saved when you save to an .eye file.

     

    0
  • Just to clarify, about .eye file, to let a custom class be saved you need to extend our proprietary file format as explained in the Extendibility paragraph here

    0

Please sign in to leave a comment.

Didn't find what you were looking for?

New post