Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Scripting Define and Pre-Export Method

Discussion in 'Unity Build Automation' started by dave_e3ct, Mar 21, 2017.

  1. dave_e3ct

    dave_e3ct

    Joined:
    Nov 7, 2016
    Posts:
    12
    Has anyone had problems with Pre-Export method not being called when you have a "Scripting Define Symbols"

    I use #defines to build numerous slightly different versions of the same app, but the Pre-Export needs to be called to enable and disable some game objects.

    What I've found is if I have an entry in the "Scripting Define Symbols" (i.e. my #define) then the Pre-Export Method function is not called.
    If I remove everything from the "Scripting Define Symbols" then the Pre-Export method is called.

    Is this only me with the issue or has anyone else found it?
    I'm trying to work around using the BundleID but that won't work for all builds. Anyone else got a workaround?

    Thanks,
    Dave
     
  2. dannyd

    dannyd

    Unity Technologies

    Joined:
    Jun 3, 2014
    Posts:
    785
    I don't think this is a generic issue with scripting defines / pre-export methods. Is your pre-export method wrapped in any #define conditionals? Do you have custom .rsp files checked into your repo? How are you verifying whether or not the pre-export method is called?
     
  3. dave_e3ct

    dave_e3ct

    Joined:
    Nov 7, 2016
    Posts:
    12
    No .rsp files in the project at all. No #def's around the pre-export.

    I just do a Debug.LogWarning to see if the pre-export is called. If it isn't the code won't compile as it turns on and off some game object to modify the build.
    In the builds without a #define, the "PreExport() called" is in the logs and it builds.
    If I add a #define then "PreExport() called" isn't in the logs and the compile fails due to it not doing it's magic.

    Are many people using #defines and pre-export?

    Would it help if I set up a dummy project with pretty much nothing in it to show it not working?
    Thanks,
    Dave

    A chunk of my pre-export function is below.

    Code (CSharp):
    1. public class cloudHelper
    2. {
    3.     public static void PreExport(UnityEngine.CloudBuild.BuildManifestObject manifest)
    4.     {
    5.         Debug.LogWarning("PreExport() called");
    6.         CloudBuildManifest manifestObj = new CloudBuildManifest(manifest);
    7.  
    8.  
     
  4. dannyd

    dannyd

    Unity Technologies

    Joined:
    Jun 3, 2014
    Posts:
    785
    Strange, I can't think of why that would be problematic. A small example project showing the behavior would be awesome.