Serialize

How do you make an object able to be sent in a package, without causing exceptions?
do you just add @Serializable to the start? (I could test but I’m too lazy :p)

When you say object… do you mean Spatial?

And… just throwing this out there… I have had issues with serializing Vector2f,3f,4f… No clue why… probably something I did… but… just mentioning it incase there is a real reason for it. Would make serializing Spatials an issue.

Vector3f should be sent fine but you can’t send nulls is all. I don’t think default support is provided for the others so you would have to register your own serializers for those.

To the OP, all contained classes would have to be @Serializable also… or you would have to specifically register serializers for them.

And if you mean you want to send a Spatial then you are doing it 100% wrong, anyway. So you may want to be more specific.

Sorry, I meant object as in object-oriented programming object :slight_smile:

Object… then:

implements Serializable
Make sure you add: private static final long serialVersionUID = Whatever;

@t0neg0d said: Object... then:

implements Serializable
Make sure you add: private static final long serialVersionUID = Whatever;

Since he is asking about networking then I’m going to assume he means SpiderMonkey serialization instead of the 10x bigger JDK serialization.

…but perhaps that is also worth clarifying.

@pspeed said: Since he is asking about networking then I'm going to assume he means SpiderMonkey serialization instead of the 10x bigger JDK serialization.

…but perhaps that is also worth clarifying.

Lol… yeah… more than likely… sorry!

:facepalm: Yes I was talking about networking :slight_smile: