Prefab Serialization

Options
erre
erre
Hi,

We are having a problem with TSTransform2D on prefab instances. I'll try to explain myself:

We have a bouncing platform prefab. In a scene we have 6 instances of this prefab (already in scene, not created runtime).

For debug, we write this inspector for TSTransform2D:

[CustomEditor(typeof(TSTransform2D))]
public class TSTransform2DInspector : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();

TSTransform2D tsTransform2D = target as TSTransform2D;

if (tsTransform2D == null)
return;

string positionLabel = "Position --> (" + tsTransform2D.position.x + ", " + tsTransform2D.position.y + ")";
string rotationLabel = "Rotation --> (" + tsTransform2D.rotation + ")";

string serializedLable = (tsTransform2D.serialized) ? "Serialized: OK!" : "WARNING: Not serialized";

EditorGUILayout.LabelField(positionLabel, EditorStyles.label);
EditorGUILayout.LabelField(rotationLabel, EditorStyles.label);

EditorGUILayout.Space();

EditorGUILayout.LabelField(serializedLable, EditorStyles.label);
}
}

So I can see in every moment the TrueSync position and rotation of my objects. At editor time we see correct data. If we launch the game, all positions and rotations of the instantiated objects become equal to the prefabs serialized values.

How can we handle this? We try to do the same things on demo projects (Kicking Heads) and we saw the same thing.

Is there a correct way to handle prefab?

Thank you,
Andrea.

P.S. If we break up the prefab link, everything works fine.

Comments