playMaker

Author Topic: Fixing IL2CPP linking errors[SOLVED]  (Read 29599 times)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Fixing IL2CPP linking errors
« Reply #75 on: September 14, 2015, 12:15:37 AM »
Hi,

Thanks for reporting:

few questions :
 What version of Unity are you using?
 what version of xcode?
 what device?

 Can you paste the link.xml generated?

 bye,

 Jean

RAWilco

  • Playmaker Newbie
  • *
  • Posts: 18
    • View Profile
    • StinBeard
Re: Fixing IL2CPP linking errors
« Reply #76 on: September 14, 2015, 10:38:28 AM »
Here are the requested details:

Unity - Version 5.1.0f3 Personal
Xcode - Version 6.4
Device - iPhone 5S and iPad 2

And my link.xml contains the following:

<?xml version="1.0" encoding="utf-8"?>
<linker>
  <assembly fullname="System">
    <namespace fullname="System.Net" preserve="all" />
    <namespace fullname="System.Net.Sockets" preserve="all" />
    <namespace fullname="System.Net.Cache" preserve="all" />
    <namespace fullname="System.Net.Mime" preserve="all" />
    <namespace fullname="System.Net.Security" preserve="all" />
    <namespace fullname="System.Net.NetworkInformation" preserve="all" />
  </assembly>
  <assembly fullname="UnityEngine">
    <type fullname="UnityEngine.ParticleSystem" preserve="all" />
    <type fullname="UnityEngine.GameObject" preserve="all" />
    <type fullname="UnityEngine.Camera" preserve="all" />
    <type fullname="UnityEngine.TextMesh" preserve="all" />
  </assembly>
  <assembly fullname="UnityEngine.UI">
    <type fullname="UnityEngine.UI.Text" preserve="all" />
  </assembly>
  <assembly fullname="PlayMaker">
    <type fullname="PlayMakerFSM" preserve="all" />
  </assembly>
</linker>

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Fixing IL2CPP linking errors
« Reply #77 on: September 16, 2015, 10:34:19 PM »
Hi,

 I am puzzled, the link.xml is not what you should get if you use the sample provided.

Can you make sure you use the scene as is from the ecosystem sample?

Bye,

 Jean

RAWilco

  • Playmaker Newbie
  • *
  • Posts: 18
    • View Profile
    • StinBeard
Re: Fixing IL2CPP linking errors
« Reply #78 on: September 18, 2015, 08:24:24 AM »
The link.xml I posted is what I got after using the linker wizard with both the sample provided and my own project scenes.

I have since deleted this version of link.xml and have made a fresh one using just the sample scene (and I got the exact same result after building).

Here it is:

<?xml version="1.0" encoding="utf-8"?>
<linker>
  <assembly fullname="System">
    <namespace fullname="System.Net" preserve="all" />
    <namespace fullname="System.Net.Sockets" preserve="all" />
    <namespace fullname="System.Net.Cache" preserve="all" />
    <namespace fullname="System.Net.Mime" preserve="all" />
    <namespace fullname="System.Net.Security" preserve="all" />
    <namespace fullname="System.Net.NetworkInformation" preserve="all" />
  </assembly>
  <assembly fullname="UnityEngine">
    <type fullname="UnityEngine.Camera" preserve="all" />
    <type fullname="UnityEngine.TextMesh" preserve="all" />
  </assembly>
  <assembly fullname="PlayMaker">
    <type fullname="PlayMakerFSM" preserve="all" />
  </assembly>
</linker>

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Fixing IL2CPP linking errors
« Reply #79 on: September 24, 2015, 10:19:39 PM »
Hi,

 try not to double post please, I replied on the other thread :)

 Bye,

 Jean

braintapgames

  • Playmaker Newbie
  • *
  • Posts: 20
    • View Profile
Re: Fixing IL2CPP linking errors
« Reply #80 on: September 24, 2015, 10:42:52 PM »
Hi,

 try not to double post please, I replied on the other thread :)

 Bye,

 Jean

I deleted the post on this thread. They were two separate issues, but I repaired one part of the problem which led up to the other part in the other post. Thanks again for your help!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Fixing IL2CPP linking errors
« Reply #81 on: September 25, 2015, 04:12:40 AM »
Hi RawWilco

I can't replicated any failure with this linker, maybe you could send me the project? mail me here: jean@hutonggames.com

Thanks,

 Jean

The link.xml I posted is what I got after using the linker wizard with both the sample provided and my own project scenes.

I have since deleted this version of link.xml and have made a fresh one using just the sample scene (and I got the exact same result after building).

Here it is:

<?xml version="1.0" encoding="utf-8"?>
<linker>
  <assembly fullname="System">
    <namespace fullname="System.Net" preserve="all" />
    <namespace fullname="System.Net.Sockets" preserve="all" />
    <namespace fullname="System.Net.Cache" preserve="all" />
    <namespace fullname="System.Net.Mime" preserve="all" />
    <namespace fullname="System.Net.Security" preserve="all" />
    <namespace fullname="System.Net.NetworkInformation" preserve="all" />
  </assembly>
  <assembly fullname="UnityEngine">
    <type fullname="UnityEngine.Camera" preserve="all" />
    <type fullname="UnityEngine.TextMesh" preserve="all" />
  </assembly>
  <assembly fullname="PlayMaker">
    <type fullname="PlayMakerFSM" preserve="all" />
  </assembly>
</linker>

davidosullivan

  • Playmaker Newbie
  • *
  • Posts: 10
    • View Profile
Re: Fixing IL2CPP linking errors
« Reply #82 on: December 02, 2015, 07:37:06 PM »
I am not sure I understand this thread as I have not yet bought Playmaker (this thread puts me off)

Is this thread basically saying that if your target platform is iOS you cannot use Playmaker to Get or Set Properties on GameObjects or InvokeMethods in components/scripts?

That would seem to knock out all the functionality I am after if thats the case...

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Fixing IL2CPP linking errors
« Reply #83 on: December 02, 2015, 10:55:11 PM »
Hi,

You can actually. But it involves being aware of the Unity internal optimization when publishing to IOS ( and likely other platforms in the long run).

 Basically, if you are using Reflections, which is the case with the actions "get/set property", and "invoke method", then you need to tell Unity which classes you are reflecting, because Unity will not detect it when analyzing your project scripts and it can "strip" a class you use.

 this "linker" technic is not inherent to PlayMaker, it's actually something that is done on almost every project using advanced assets, but you are generally not aware of it because the publisher provides this link.xml file already prefilled.

 With PlayMaker, you'll have to maintain this list yourself, which is difficult if you don't know how to code, which is why I created this wizard so that you don't have to do this manually.

 So nothing scary, just a Unity workflow you need to be understanding when publishing to IOS.

It's "fully" documented on unity doc:

http://docs.unity3d.com/Manual/iphone-playerSizeOptimization.html

make sure you read all this page, with great attention, read it again and again until you understand wht it means, and let it sink in your brain.

if there is a concept on this doc page that you don't understand, then making use of Reflection is prone to issues when publishing.

In all cases. I don't recommand using reflections when publishing on mobile, and in general, just because I don't think it's a clean approach, it works and certainly allows non coders to get the job done, but sub optimal, it's like doing surgery and open your belly to feed yourself... just eat normally... that's how I see it :)

 So prefer using a dedicated custom actions accessing in conventional c# your classes and properties. If there is no available custom actions, make one or request one on this forum, and make sure you do a bit of search on both the forum and the Ecosystem, you might lucky :)

So to summarize, it's not a problem with PlayMaker, it's a advanced "feature" or Unity that needs to be learned and assimulated to publish on mobile.

 Bye,

 Jean

davidosullivan

  • Playmaker Newbie
  • *
  • Posts: 10
    • View Profile
Re: Fixing IL2CPP linking errors
« Reply #84 on: December 03, 2015, 09:30:42 AM »
Hey jeanfabre,

Thanks very much for the detailed info.

I'm a little confused though about where the 'danger' areas are. I'd have thought that any scripts/Classes that are on GameObjects in your scene would get included by Unity, is that right? So in that case the actions "get/set property", and "invoke method" should work on those without any further action needing to be taken, is that correct?

So is it the case that this is only an issue when you are reflecting methods in classes that are not MonoBehaviours and not specified as being 'used' by any Monobehaviours in the scene(s) you build?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Fixing IL2CPP linking errors
« Reply #85 on: December 03, 2015, 10:49:34 PM »
Hi,

 It's more complicated than that.

ALL scripts that are Components (MonoBehavior) attached a GamObjects featured in a Scene defined in the list of build goes in the build. All Prefabs somehow referenced in such scene will go to.

but it doesn't mean the whole scripts goes in, that way I understand this ( cause indeed there is some black magic or actually lack of documentation on how it works for real),  is that portions of scripts are stripped if found not used, and indeed when you use Get/Set Property or other reflection based actions or scripts, these portions will not be found as being used by Unity and stripped.

So indeed, this is why there is this Unity link.xml file sitting around in your project, so that you can actually force Unity to include classes without stripping them.

Bye,

 Jean

Jerry

  • Playmaker Newbie
  • *
  • Posts: 5
    • View Profile
Re: Fixing IL2CPP linking errors
« Reply #86 on: February 05, 2016, 11:36:37 AM »
Hi,

I have a problem with my linker.xml. My linker content look like this:

<linker>
  <assembly fullname="UnityEngine.UI">
    <type fullname="UnityEngine.UI.Text" preserve="all" />
    <type fullname="UnityEngine.UI.Button" preserve="all" />
    <type fullname="UnityEngine.UI.Image" preserve="all" />
  </assembly>
  <assembly fullname="UnityEngine">
    <type fullname="UnityEngine.SpriteRenderer" preserve="all" />
    <type fullname="UnityEngine.CapsuleCollider" preserve="all" />
    <type fullname="UnityEngine.Canvas" preserve="all" />
    <type fullname="UnityEngine.GameObject" preserve="all" />
    <type fullname="UnityEngine.AudioListener" preserve="all" />
    <type fullname="UnityEngine.RectTransform" preserve="all" />
    <type fullname="UnityEngine.TextMesh" preserve="all" />
    <type fullname="UnityEngine.Camera" preserve="all" />
    <type fullname="UnityEngine.GUIText" preserve="all" />
    <type fullname="UnityEngine.BoxCollider" preserve="all" />
  </assembly>
</linker>



when I make a build on xCode I get this error:

Undefined symbols for architecture arm64:
"Register_UnityEngine_GameObject_get_networkView()", referenced from:
RegisterAllStrippedInternalCalls() in UnityICallRegistration.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


I have to mention that I made all steps to remove problem with Unity Networking on IL2CPP:

"Import Assets/PlayMaker/Versions/PlayMakerNACL.unitypackage. These dlls have networking stripped out.
Delete the PlayMaker/Actions/Network folder.
Edit PlayMaker/Actions/CreateObject.cs and add UNITY_IPHONE To the #if list of platforms that don't support networking."


I also noticed that I don't get xCode errors when I remove this line:

   "<type fullname="UnityEngine.GameObject" preserve="all" />"

I also tried on clean demo project from Linker Wizard (downloaded from ecosystem). When I add this line I get xCode error as above.

Can you help me what should I do to to get rid of errors?

Unity- Ver. 4.6.2f1
Xcode- Ver. 7.2
Devide- iPad Air 2
« Last Edit: February 05, 2016, 11:38:45 AM by Jerry »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Fixing IL2CPP linking errors
« Reply #87 on: February 14, 2016, 11:46:48 PM »
Hi,

 I don't have time to test this right now, but I would remove the offending declaration ( GameObject preserve all), and see if everything is working fine in the logic.

 Also, what property are you trying to reflect on GameObject? I think we covered everything with regular actions for gameobject properties, and it's indeed the best way to go. Get and Set Property are good for accessing the odd property on a custom component, but if you can use a regular action please do.

Bye,

 Jean

gozda

  • Junior Playmaker
  • **
  • Posts: 88
    • View Profile
Re: Fixing IL2CPP linking errors
« Reply #88 on: May 06, 2016, 01:04:12 AM »
Linker Wizard safe my life.

i got this error
(Filename: currently not available on il2cpp Line: -1)

It was project moved from u4.6 to 5.3.3

Big Thanks!

indeed

  • Junior Playmaker
  • **
  • Posts: 54
    • View Profile
Re: Fixing IL2CPP linking errors
« Reply #89 on: July 30, 2016, 10:10:00 AM »
Hi I ran the Wizard which works for some things, but I'm having an issue where it seems to be ignoring Set Property when controlling an Ellipsoid Particle Emitter's "emit" active state and building for iOS. The Wizard correctly added:

<type fullname="UnityEngine.EllipsoidParticleEmitter" preserve="all" />

to the XML so I'm not sure why it's not working. I also tried building it without stripping active. It still doesn't work. However everything works great in the editor and fine on iOS in Mono2x. Any idea?