playMaker

Author Topic: Automation to substitute Get/Set Properties from Unity 4.x to 5.x  (Read 8210 times)

twiggyash

  • Playmaker Newbie
  • *
  • Posts: 13
Hi, I'm using playmaker on Unity 4.7 and my project is full of Set/Get Properties no more allowed in Unity 5.x . Is there a way to automatically convert these in the new format? Cause doing it manually is impossible for me, is like restart the project from beginning. Hope in a solution.

Thank you very much for help!

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Automation to substitute Get/Set Properties from Unity 4.x to 5.x
« Reply #1 on: March 30, 2016, 09:04:27 AM »
What do you mean it is not allowed? I am in 5.2 and I am still using get/set.. are you sure about this?

twiggyash

  • Playmaker Newbie
  • *
  • Posts: 13
Re: Automation to substitute Get/Set Properties from Unity 4.x to 5.x
« Reply #2 on: March 30, 2016, 10:00:59 AM »
I mean this: "Unity 5 removed properties that allowed you to target common components on a GameObject (e.g., guiTexture, renderer, rigidbody...). If you targeted these properties with Get Property or Set Property actions the target no longer exists and you will need to re-target the action. Instead, you should target the component directly - drag the Component into the Target Object field NOT the GameObject."

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3999
  • Official Playmaker Support
    • LinkedIn
Re: Automation to substitute Get/Set Properties from Unity 4.x to 5.x
« Reply #3 on: March 30, 2016, 11:09:38 AM »
Let me look into this, there might be a way to use the action's error check method to automatically upgrade the action...

twiggyash

  • Playmaker Newbie
  • *
  • Posts: 13
Re: Automation to substitute Get/Set Properties from Unity 4.x to 5.x
« Reply #4 on: March 30, 2016, 11:20:38 AM »
Would be great!!! Thank you a lot for help!

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3999
  • Official Playmaker Support
    • LinkedIn
Re: Automation to substitute Get/Set Properties from Unity 4.x to 5.x
« Reply #5 on: March 31, 2016, 02:13:59 PM »
Please try the attached script. It modifies PlayMaker > Tools > Update All FSMs in Build.

BACKUP your project first and treat this script as a BETA!!

This script updates any Get Property or Set Property actions on a GameObject that targets the properties removed in Unity 5+.

How it works:

- It loops through all scenes in Build Settings.
- It finds all Get Property and Set Property actions.
- If the property was removed in Unity 5:
  - It replaces Target Object with a direct reference to the component.
  - It modifies the Property Path to be relative to that component.

Limitations:

- It does NOT work on Templates. Automatically updating a template would involve adding Get Component actions and variables. This is more invasive than modifying the Get/Set Property actions. If you really need a solution for templates we could explore a modified version of the Get/Set Property actions that would detect the removed properties and use GetComponent, but performance would be slower than updating the FSMs manually.
- The targeted components have to exist on the GameObject when you run the update script. The script uses GetComponent to update the actions. If you add the components at runtime you will need to add a GetComponent action.

Please post your results and any problems you run into.
« Last Edit: April 05, 2016, 02:24:34 PM by Alex Chouls »

twiggyash

  • Playmaker Newbie
  • *
  • Posts: 13
Re: Automation to substitute Get/Set Properties from Unity 4.x to 5.x
« Reply #6 on: April 01, 2016, 09:30:09 PM »
Thank you very much for support! I'll try this as soon as possible and I'll let you know the results. Thanks again!

twiggyash

  • Playmaker Newbie
  • *
  • Posts: 13
Re: Automation to substitute Get/Set Properties from Unity 4.x to 5.x
« Reply #7 on: April 04, 2016, 09:50:15 PM »
Please try the attached script. It modifies PlayMaker > Tools > Update All FSMs in Build.

BACKUP your project first and treat this script as a BETA!!

This script updates any Get Property or Set Property actions on a GameObject that targets the properties removed in Unity 5+.

How it works:

- It loops through all scenes in Build Settings.
- It finds all Get Property and Set Property actions.
- If the property was removed in Unity 5:
  - It replaces Target Object with a direct reference to the component.
  - It modifies the Property Path to be relative to that component.

Limitations:

- It does NOT work on Templates. Automatically updating a template would involve adding Get Component actions and variables. This is more invasive than modifying the Get/Set Property actions. If you really need a solution for templates we could explore a modified version of the Get/Set Property actions that would detect the removed properties and use GetComponent, but performance would be slower than updating the FSMs manually.
- The targeted components have to exist on the GameObject when you run the update script. The script uses GetComponent to update the actions. If you add the components at runtime you will need to add a GetComponent action.

Please post your results and any problems you run into.

Hi again, finally tried the script but, after selecting Update all Fsms in Build, in few seconds Unity crashed. Tried more times but it always crashes.

I'm using Unity last version 5.3.4. and Playmaker 1.8.0


Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3999
  • Official Playmaker Support
    • LinkedIn

twiggyash

  • Playmaker Newbie
  • *
  • Posts: 13
Re: Automation to substitute Get/Set Properties from Unity 4.x to 5.x
« Reply #9 on: April 04, 2016, 11:09:52 PM »
Here it is.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3999
  • Official Playmaker Support
    • LinkedIn
Re: Automation to substitute Get/Set Properties from Unity 4.x to 5.x
« Reply #10 on: April 05, 2016, 01:44:22 PM »
Thanks! It looks like Unity is crashing on an Undo in the batch operation, maybe running out of memory. So I've removed the Undo (you can't really undo the batch operation anyway, you'd have to revert to a backup). I've updated the original download. Please give it another go!

twiggyash

  • Playmaker Newbie
  • *
  • Posts: 13
Re: Automation to substitute Get/Set Properties from Unity 4.x to 5.x
« Reply #11 on: April 05, 2016, 01:54:49 PM »
Thanks! It looks like Unity is crashing on an Undo in the batch operation, maybe running out of memory. So I've removed the Undo (you can't really undo the batch operation anyway, you'd have to revert to a backup). I've updated the original download. Please give it another go!
Hi :) this time when imported the console gives me this error:

Assets/PlayMaker/Editor/PlayMakerProjectTools.cs(173,37): error CS0103: The name `SetFsmDirty' does not exist in the current context

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3999
  • Official Playmaker Support
    • LinkedIn
Re: Automation to substitute Get/Set Properties from Unity 4.x to 5.x
« Reply #12 on: April 05, 2016, 02:25:15 PM »
Sorry about that. Fixed. Please download it again :)

twiggyash

  • Playmaker Newbie
  • *
  • Posts: 13
Re: Automation to substitute Get/Set Properties from Unity 4.x to 5.x
« Reply #13 on: April 05, 2016, 04:28:56 PM »
Sorry about that. Fixed. Please download it again :)
Tried. Ok, it works quite well with Get/Set actions about GameObjects, but many activate/deactivate render mesh actions doesn't work.
There are problems with particle systems too, none works.
I noticed problems too with skinned meshes; basically when a skinned mesh is child of another, the actions that were about the child skinned mesh, now are changed to the parent skinned mesh.
These are the major issues for what I saw at the moment.

Thank you for your efforts and support.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3999
  • Official Playmaker Support
    • LinkedIn
Re: Automation to substitute Get/Set Properties from Unity 4.x to 5.x
« Reply #14 on: April 05, 2016, 07:52:18 PM »
Quote
many activate/deactivate render mesh actions doesn't work.
There are problems with particle systems too, none works.
I noticed problems too with skinned meshes;

Which actions are you using in these cases? Can you give me examples?
If you can fix the problems manually let me know how and maybe we can automate it. But I need specific examples...