Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: enrickla on October 23, 2014, 12:04:33 AM

Title: Unity 5 + Playmaker compilation error :/
Post by: enrickla on October 23, 2014, 12:04:33 AM
Hi Everyone,

I have Unity 5.0.0b8 and playmaker integrated. Playmaker work perfectly but when I try to compile, it give me this error:

Quote
Assets/PlayMaker/Actions/AddComponent.cs(56,88): error CS0619: `UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent(UnityEngine.GameObject, string, string)' is obsolete: `Method is not meant to be used at runtime. Please, replace this call with GameObject.AddComponent<T>()/GameObject.AddComponent(Type).'


When I click the error, unity bring me at this line:

Code: [Select]
addedComponent = UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent(go, "Assets/PlayMaker/Actions/AddComponent.cs (56,21)", component.Value);

Thank you for your help!
Title: Re: Unity 5 + Playmaker compilation error :/
Post by: Alex Chouls on October 23, 2014, 01:12:11 AM
Unity 5 has some breaking API changes. Unity tries to update scripts automatically, but it looks like in this case it has mangled the AddComponent action.

If you're not using AddComponent you could try deleting that action, but Unity might have mangled more files...

Alternatively the current Playmaker 1.8.0 beta works with Unity5. If you PM me I can send you an invite to the beta.
Title: Re: Unity 5 + Playmaker compilation error :/
Post by: Phuzz on December 28, 2014, 03:15:05 PM
This is happening with the Addscript action too, I deleted the Addcomponent action, but I still need the AddScript, any workaround?
Title: Re: Unity 5 + Playmaker compilation error :/
Post by: Game Daddy on January 03, 2015, 04:09:56 PM
Having the same issue in Unity 5 beta 18.
Title: Re: Unity 5 + Playmaker compilation error :/
Post by: Mike Salvo on January 22, 2015, 04:36:08 PM
Was someone able to solve this issue?
Title: Re: Unity 5 + Playmaker compilation error :/
Post by: timofei7 on March 03, 2015, 09:10:30 PM
Yep,  you have to do:
         var t = System.Type.GetType(component.Value);
         addedComponent = go.AddComponent(t);

instead of the auto converted line that looks something like:
         //addedComponent = UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent(go, "Assets/PlayMaker/Actions/AddScript.cs (51,21)", script.Value);


Unity has a blog post about this api change here:
http://blogs.unity3d.com/2015/01/21/addcomponentstring-api-removal-in-unity-5-0/ (http://blogs.unity3d.com/2015/01/21/addcomponentstring-api-removal-in-unity-5-0/)

in AddScript it is the same thing with script.Value instead
Title: Re: Unity 5 + Playmaker compilation error :/
Post by: Alex Chouls on March 03, 2015, 10:11:15 PM
The 1.7.8 update should fix this. Make sure you update PlayMaker in the Unity 5 Asset Store then import. Please let me know if this doesn't work! Asset Store support for different packages for different versions of Unity is still fairly new, so there may be teething problems...
Title: Re: Unity 5 + Playmaker compilation error :/
Post by: Gua on March 15, 2015, 11:57:55 PM
The 1.7.8 update should fix this. Make sure you update PlayMaker in the Unity 5 Asset Store then import. Please let me know if this doesn't work! Asset Store support for different packages for different versions of Unity is still fairly new, so there may be teething problems...
I have 1.7.8 and I still got this error. I've integrated package from your store, so it's not and asset store error. But I I'll got to Playmaker -> About it shows 1.7.7.f6 is it normal or I did messed up something?
Title: Re: Unity 5 + Playmaker compilation error :/
Post by: Alex Chouls on March 16, 2015, 12:04:04 AM
Update in the Asset Store or download from our store again. The about window should say 1.7.8.2.

Also if you're updating a Unity 4.x project, please see this thread:
http://hutonggames.com/playmakerforum/index.php?topic=9823.msg46693

And the troubleshooting page here:
https://hutonggames.fogbugz.com/default.asp?W624
Title: Re: Unity 5 + Playmaker compilation error :/
Post by: 90degreedesigns on April 03, 2015, 05:54:42 PM
I know I am a little late to the party here, but for those who refuse to update like I do, attached are addcomponent and addscript that have been updated for Unity 5. I include both of them, because both were needed for me as it stopped on one, and then the other when I got the first fixed. Replace them with your current ones and you'll be ready to rock.
Title: Re: Unity 5 + Playmaker compilation error :/
Post by: boragungor on May 20, 2015, 02:37:51 PM
I know I am a little late to the party here, but for those who refuse to update like I do, attached are addcomponent and addscript that have been updated for Unity 5. I include both of them, because both were needed for me as it stopped on one, and then the other when I got the first fixed. Replace them with your current ones and you'll be ready to rock.

Many thanks, mate ! =)
Title: Re: Unity 5 + Playmaker compilation error :/
Post by: HyperExc on September 12, 2015, 07:54:12 PM
I know I am a little late to the party here, but for those who refuse to update like I do, attached are addcomponent and addscript that have been updated for Unity 5. I include both of them, because both were needed for me as it stopped on one, and then the other when I got the first fixed. Replace them with your current ones and you'll be ready to rock.


Really appreciate it! You the man!!! :)))
Title: Re: Unity 5 + Playmaker compilation error :/
Post by: memetic arts on November 05, 2015, 04:29:55 PM
Many thanks as well!  Need to build for a demo, no time to update, so again, many thanks!!
Title: Re: Unity 5 + Playmaker compilation error :/
Post by: 90degreedesigns on November 05, 2015, 06:41:52 PM
I'm happy we helped quite a few people here  ;D I thought I was the only one refusing to update there for awhile. Just remember to check us out on Google Play Store.  ;)

Most importantly thank you Jean for the most useful asset to ever come to Unity.
Title: Re: Unity 5 + Playmaker compilation error :/
Post by: jeanfabre on November 06, 2015, 07:08:24 AM
Hi,

 All credits goes to Alex :)

Bye,

 Jean