googleanalytics / google-analytics-plugin-for-unity

Google Analytics plugin for the Unity game creation system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PostprocessBuildPlayer_GA doesn't add framework and libs in the XCode project

stanislasbonifetto opened this issue · comments

My environment is:
SO: OSX 10.11.5
Unity: 5.3.3f1
XCode: 7.3.1

I followed the guide https://developers.google.com/analytics/devguides/collection/unity/v4/devguide#ios
I did point 2 and 3.

But the script PostprocessBuildPlayer_GA didn't add the frameworks and libs in the Unity-iPhone.xcodeproj/project.pbxproj file.

In my environment the llbs libz.dylib and libsqlite3.dylib didn't exist (see issue #131).

The problem is not the wrongs libs, because I tried to fix with the correct libs (libz.tbd, libsqlite3.tbd) but did't work.

Hi,

PostprocessBuildPlayer deprecated Unity 5.3

You can insert PostProcessBuildPlayer.cs to some Editor folder and it will work 👍

using System;
using System.Diagnostics;
using System.IO;
using UnityEditor;
using UnityEditor.Callbacks;

public class PostProcessBuildPlayer {

    [PostProcessBuildAttribute(1)]
    public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) {
        UnityEngine.Debug.Log("Running post-process build scripts.");

        FileInfo[] postProcessFiles = new DirectoryInfo(Environment.CurrentDirectory).GetFiles("PostprocessBuildPlayer_*", SearchOption.AllDirectories);
        foreach (var file in postProcessFiles) {
            if (file.Name.EndsWith(".meta")) {
                continue;
            }

            UnityEngine.Debug.Log("Running post-process " + file);
            Process.Start(file.FullName, pathToBuiltProject);
        }
    }
}

Using the old scripts is no longer necessary, I've submitted a PR #138 to support the new build pipeline using the unity provided tools from the UnityEditor.iOS.Xcode namespace