[Solved] Refactoring: How to rename DataMembers

If I decide to rename some public fields in my Scripts or Components, I run into problems here.
The asset compiler complains about being unable to deserialize the old property from MainScene.pdxscene (which of course is correct since it aint available under that name anymore).

Now I tried to manually replace the old property name with the new one in the pdxscene file, but I keep getting the same complaint, just with the new property now (I re-checked for typos). Asset compiler says the property is not found in the type in question.

I tried to remove the assignments from the pdxscene file completely (manually) but now the asset compiler throws an exception “Serialization contentRef indices are out of sync”.

So what is the suggested way of doing some refactoring like that?

Edit:

Ok, seems I screwed up. I undid all my changes to my class renamings and to the pdxscene, but the asset compiler refuses to compile with the same message that it can not deserialize that property (which is back at it’s old name and which is definitely part of my class). Any idea what to try?

Edit2:

I restarted and rebuilt everything, but the error stuck with me. Only after restarting the whole computer I can now build and run the solution. The question remains though, how am I supposed to do refactoring?

Hi seven,

I tried to reproduce your problem here but it didn’t seem to behave as you described.
When I rename a public field of my script, the game still compile and launch. The value of the field is null at runtime though. If I properly set it again from the studio, then it works fine. It also works fine if rename the old field manually in the pdxscene file.

Could you add more details or repro?

Thanks

Hi,

I think my project meanwhile reached a stage of utter inconsistence, probably due to all my uneducated fiddling since the upgrade from 1.2ß. I now always have to compile twice since on the first run there is always a complaint about a missing material and other odd behaviours.
I guess just setting it up from scratch will save everyone a lot of time. Should similar problems arise, I will try and boil it down to something easily reproducable.

So, when refactoring it should be no problem to manually rename the properties/fields in the pdxscene accordingly, yes? I’ll just mark that solved then. :thumbsup: