/// <summary> /// Creates a text shape for serialisation. /// </summary> /// <param name="shapeComponent">The component to create a shape for.</param> /// <returns>A shape instance suitable for configuring to generate serialisation messages.</returns> protected override Shapes.Shape CreateSerialisationShape(ShapeCache cache, int shapeIndex, CreateMessage shape) { TextShapeData textData = cache.GetShapeDataByIndex <TextShapeData>(shapeIndex); // Note: initialise position to zero. SetAttributes() below will overwrite this. var textShape = new Shapes.Text3D(textData.Text, shape.ObjectID, shape.Category, Maths.Vector3.Zero); textShape.SetAttributes(shape.Attributes); return(textShape); }
/// <summary> /// Creates a text shape for serialisation. /// </summary> /// <param name="shapeComponent">The component to create a shape for.</param> /// <returns>A shape instance suitable for configuring to generate serialisation messages.</returns> protected override Shapes.Shape CreateSerialisationShape(ShapeComponent shapeComponent) { TextMesh text = shapeComponent.GetComponent <TextMesh>(); if (text != null) { Shapes.Shape shape = new Shapes.Text3D(text.text); ConfigureShape(shape, shapeComponent); return(shape); } return(null); }