Magic Leap Unity Zero Iteration Debugging with Visual Studio Community

Here is a procedure for debugging and stepping through code on a Unity application that is running in a Zero Iteration session on the Magic Leap device via the Magic Leap Remote. This has been tested on Visual Studio for Mac Community v7.4.3 (Build 10) that is installed using the Unity 2018.1.9f1-MLTP8.1 installer.

1) Make sure your Magic Leap is powered on and ready, then attach your Magic Leap device to your computer

2) Start the Magic Leap Remote and click "Start Device", to get the device into Zero Iteration mode.

3a) Start Unity and load your Magic Leap Unity project

3b) Within Unity, in Build Settings, in Magic Leap, be sure to enable the "Development Build" checkbox

3c) Within Unity, click on the Magic Leap menu item and enable Zero Iteration. Unity will let you know you will need to restart Unity, click Restart.

3d) After Unity has restarted then select a GameObject that already has a script attached and select Edit Script within the Inspector. This will open the Visual Studio solution for your Unity Project

4) Within Visual Studio, in the Solution Pane, right click on the top-level Project Solution item (this should be named the same as your Unity Project) and select "Debug Item". You will see that Visual Studio has entered Debug mode. You can now set break points where you need them.

5) Within Unity, click the Play button, this will load the App and start your Zero Iteration session on your device. When any of your Visual Studio breakpoints are hit, then flow of control will halt inside Visual Studio at a breakpoint and you can then inspect variables, etc.

Unity Magic Leap Automated Build

For Continuous Integration of Magic Leap Unity Applications

1) In Unity, in your Assets folder, create a folder named 'Editor'

2) Create the an empty script, inside the 'Editor' folder. Be sure to name the script file: 'MyEditorScript'

3) Double click the script, to open it in Visual Studio and edit it as follows (changing the paths):

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEditor;

using UnityEditor.Build.Reporting;

public class MyEditorScript : MonoBehaviour {

// Use this for initialization

void Start () {

}

// Update is called once per frame

void Update () {

}

public static void PerformBuild()

{

string[] scenes = { };

BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();

buildPlayerOptions.scenes = new[] { "Assets/Scenes/your_scene.unity" };

buildPlayerOptions.locationPathName = "/path/to/your/unityproject/yourapp.mpk";

buildPlayerOptions.target = UnityEditor.BuildTarget.Lumin;

BuildReport report = BuildPipeline.BuildPlayer(buildPlayerOptions);

BuildSummary summary = report.summary;

if (summary.result == BuildResult.Succeeded)

{

Debug.Log("Build succeeded: " + summary.totalSize + " bytes");

}

if (summary.result == BuildResult.Failed)

{

Debug.Log("Build failed");

}

}

}

4) In Visual Studio, click on Build All, to build the script. This will build the 'MyEditorScript.cs.meta' file.

5) Execute the commandline: /Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -username 'your@email' -password 'your_password' -projectPath '/path/to/your/unityproject' -buildTarget Lumin -executeMethod MyEditorScript.PerformBuild

6) Check ~/Library/Logs/Unity/Editor.log for any errors/status of the build

7) If all goes well you should see the following two files:

/path/to/your/unityproject/yourapp.mpk

/path/to/your/unityproject/com.yourcompany.yourapp.package

Rodney Degracia

October 2018

pig-0.13.0 and hadoop-2.4.0

Experimenting with pig (thanks to the Orlando Data Science tool training class for the introduction), and it's really a lot of fun to work with for simple queries.

--
-- Rodney Degracia
--
-- July 2014
--
-- Script to find the frequency of books published each year
--
-- http://www2.informatik.uni-freiburg.de/~cziegler/BX/
-- 
-- 
-- http://www.orzota.com/pig-for-beginners/
-- Clean up the data first
-- sed -e 's/\&/\&/g' BX-Books.csv | sed -e '1d' | sed -e 's/;/$$$/g' | sed -e 's/"$$$"/";"/g'> BX-BooksCorrected.txt
--
-- Hadoop-2.4.0
-- Pig-0.13.0
-- Debian 7.5
-- 

BookXRecords = LOAD '/hduser/BX-BooksCorrected.txt'
USING PigStorage(';') AS (ISBN:chararray,BookTitle:chararray,
BookAuthor:chararray,YearOfPublication:chararray,
Publisher:chararray,ImageURLS:chararray,ImageURLM:chararray,ImageURLL:chararray);


GroupByYear = GROUP BookXRecords BY YearOfPublication;


CountByYear = FOREACH GroupByYear
GENERATE CONCAT((chararray)$0,CONCAT(':',(chararray)COUNT($1)));


STORE CountByYear 
INTO '/hduser/pig_output_bookx' USING PigStorage('t');

 

git merge force overwrite

Sometimes, it is necessary to force merge another branch that is known to be the latest source code. This is especially the case where certain files are huge textual, but non-human parseable and therefore a normal git merge is not feasible.

Git merge the branch and prefer the changes within the branch:

git merge -s recursive -X theirs branch

git merge two repos

To merge two different repos and keep histories is very easy with git:

First create a branch for the other project

git checkout master
git checkout -b other-project-branch

Then add a remote that points to the other project

git remote add remote-repo gitosis@myserver.com:otherproject.git

Finally, fetch and merge

git fetch remote-repo
git merge remote-repo/other-project-branch #SEE NOTE BELOW!

NOTE: If you know that the other project will cause a merge conflict and you want to force the merge then use:

git merge -s recursive -X theirs remote-repo/other-project-branch

Homebrew and Macports

1) Safely install Homebrew into into its own directory (downloaded bottles will be downloaded into here)

cd ~
mkdir ~/Developer
cd ~/Developer
git clone https://github.com/mxcl/homebrew.git

2) To set up the symlinks without having to chown /usr/local, just use chmod o+w

sudo chmod -R o+w /usr/local

3) Symlink the Cellar from /usr/local to ~/Developer/homebrew. This is necessary so that installed bottles can reference Cellar correctly.

ln -s ~/Developer/homebrew/Cellar /usr/local/Cellar

4) Install the bottle, in this case I used erlang. Be aware that Homebrew will still create symlinks into /usr/local

brew install erlang

5) Now that the bottle is installed, change the permissions on /usr/local back using chmod o-w

sudo chmod -R o-w /usr/local

Note: When installing more bottles, just do step 2, then step 4, and finally step 5.