Hello Guest

Author Topic: editor textmesh text  (Read 5043 times)

kurayami88

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 14
    • View Profile
editor textmesh text
« on: March 31, 2014, 04:09:39 pm »
i made an editor-script that would alter the tk2dtexhmesh's text to "some-text" during edit mode...of which the changes shows in the editor window.

however, the changes are reverted once i click play... and the old editor values are also reverted once i un-play the game.
e.g.,
original text = abc
editor script alters the text to -> efg
upon scene play -> text = abc (old value)
upon scene stop-play -> text = abc (old value)
run editor script again -> efg ....

manual editing of tk2dtexhmesh to xyz
editor script alters the text to -> efg
upon scene play -> text = xyz (new manual input value)
upon scene stop-play -> xyz (new manual input value)
run editor script again -> efg ....


but the values of the editor script does not persist even though it was changed... is there like some text value saving / cache somewhere ? of which tk2dtextmesh.text = 'value' does not reflect the cached version?

-------

the reason i have this editor text change is that i am pulling the text from somewhere else during edit mode and i want them to sync rather than me going to the textmesh and updating the values one by one...

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: editor textmesh text
« Reply #1 on: March 31, 2014, 07:18:45 pm »
Do you call EditorUtility.SetDirty after changing it?

kurayami88

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: editor textmesh text
« Reply #2 on: April 01, 2014, 10:34:33 am »
setDirty / applymodifiedProperties / script.update()

all did not do anything...

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: editor textmesh text
« Reply #3 on: April 01, 2014, 10:37:57 am »
how are you setting this value?

kurayami88

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: editor textmesh text
« Reply #4 on: April 01, 2014, 10:54:42 am »
probably my mistake...

but now i'm trying to figure out how to save the values directly...
my script has a reference to the tk2dTextMesh.

I am currently calling the reference of the textmesh and setting the text directly... but update() / applyModifiedProperties() / setDirty() will not work because the 'target' is not the tk2dtextMesh but my script which has the reference of it... is there a way to get the tk2dtextmesh as a serializableObject for me to force it dirty?

kurayami88

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: editor textmesh text
« Reply #5 on: April 01, 2014, 11:31:20 am »
is there a way to update (set dirty) another script indirectly without the inspector looking at it?

because 'target' in the unity editor is referring to the current inspected property but that property does not have the tk2dTextMesh that is being updated.

i can currently set the text indirectly but i cannot save the value of it...

kurayami88

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: editor textmesh text
« Reply #6 on: April 01, 2014, 11:38:52 am »
it's ok... i found it :)

tq for your help... or atleast giving me a clue :P