Closed sevi78 closed 1 year ago
import bge
G = bge.logic
sce = G.getCurrentScene()
t = sce.addObject("Text",own,0.0)
t.worldPosition = (-2,0,0)
t["Text"] = "text"
## so far so good, t["Text"] shows "text"
## now after adding another Text, t["Text"] shows "text2"
t1 = sce.addObject("Text",own,0.0)
t1.data = t1.data.copy()
t1.worldPosition = (0,0,0)
t1["Text"] = "text2"
Thanks so much !! you are my hero! but:
AttributeError: 'KX_FontObject' object has no attribute 'data'
oh sorry
t1 = sce.addObject("Text",own,0.0)
t1.blenderObject.data = t1.blenderObject.data.copy()
t1.worldPosition = (0,0,0)
t1["Text"] = "text2"
KX_Object.blenderObject is the bpy.data.objects ob the KX_Object is 'wearing'
works !!! thanks ! i mean its a workaround, would be nice to have the behaviour like a KX_GameObject. Buts its fine for me
if we edit a mesh, all copies 'wearing' the mesh are effected.
so it is the same really, but instead of editing a mesh we are editing a text object,
the blender text object can do all sorts of fancy stuff using KX_Font.BlenderObject.data.curves I believe. (like set the text to use multiple materials)
i have also tried with instantAddObject and Actuators with the same result
Originally posted by @sevi78 in https://github.com/UPBGE/upbge/issues/1297#issuecomment-1426930460