Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

IL2CPP BUGS IN ANDROID BUILD

Discussion in 'Editor & General Support' started by youngmusa, Nov 10, 2020.

  1. youngmusa

    youngmusa

    Joined:
    Apr 15, 2018
    Posts:
    13
    Can anybody help me here please, basically I have an AI(zombie) which just wanders around the scene and when it sees the player it starts to chase him, everything works fine in the editor perfectly and also on mono build....but I don't know why but when I switch to the script backnend to IL2CPP so I can upload on the play store, I noticed that all my AI would just walk literally straight in the same direction and when the player gets close to them they don't react at all??? Please I don't know whys this happening, I've figured it only happens on IL2CPP because when I switch to mono, everything works fine!
    But I can't upload my game to the play store using mono as it's only 32bit :(

    And sorry I didn't know where to post this thread.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    You'll need to add debugging to all the code you expect to be working, but isn't, to figure out where things are going wrong. Unfortunately, just posting that certain things aren't working without code or any actual information on what is happening, no one can really help.
     
  3. youngmusa

    youngmusa

    Joined:
    Apr 15, 2018
    Posts:
    13
    Oh Do you mean debug them in the actual unity editor or..? Because in the editor it doesn't show any problems at all everything works fine but soon as built the AI's become stupid I personally think it's got something to do with the code striping?
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    No, add Debug.Log statements everywhere in your code you are having problems, including outputing the values of important variables. Run the game on your device, reproduce the problems, and check the logs on the device for that output. You're likely to notice a discrepancy between how you expect the code to be running, and how it is actually running. At that point you can start figuring out what is going wrong.

    In case you don't know where the logs get written:
    https://docs.unity3d.com/Manual/LogFiles.html
     
    Last edited: Nov 10, 2020
  5. youngmusa

    youngmusa

    Joined:
    Apr 15, 2018
    Posts:
    13
    Thank you very much I've now logged at some and managed to debug the game and now I'm seeing where the problems are coming from now. It says "set method not found for 'destination' and then a bit below in the lines it says " currently not available on IL2CPP? I'll show you a screenshot!

    Does this mean that the AI cannot read the destination or what?
     

    Attached Files:

  6. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    The first thing that pops into my head with that error and Reflection is maybe this is code stripping. So the first thing I'd try is setting Managed Code Stripping to disabled, create a new build, and retest. If that fixes the issue, maybe investigate the "To declare that a Project is using such code" part below.

    https://docs.unity3d.com/Manual/ManagedCodeStripping.html

    https://docs.unity3d.com/Manual/ScriptingRestrictions.html

     
  7. youngmusa

    youngmusa

    Joined:
    Apr 15, 2018
    Posts:
    13
    I've figured it had something to do with the code stripping but that's the problem you can't disable that option at all when it's set to IL2CPP, you only have 3 options to choose from (low, medium and high"
     
  8. youngmusa

    youngmusa

    Joined:
    Apr 15, 2018
    Posts:
    13
    Actually it's all good now, I seemed to have fixed it myself as I was setting the AI destination from the set property on it, but just switched it to a script which sets the destination rather than setting and changing the actual property of the game object