Unity: Remove AR Support module

If you’ve installed Vuforia and then decided that it’s a much smarter move to just use the ARKit plug-in instead then you can remove the AR-Support module by deleting it from your Unity install directory. Make sure you close Unity first

C:\Program Files\[Unity2017.3.1]\Editor\Data\PlaybackEngines




Unity: UnityEngine.Advertisements.dll could not be found

If you’re seeing an error when building a Unity project with Jenkins on Windows, and it looks something like this…

error CS0006: Metadata file 'Unity/cache/packages/packages.unity.com/com.unity.ads@2.0.3/UnityEngine.Advertisements.dll' could not be found

…then it’s probably caused by Unity PackageManager (introduced in 2017.2) looking a file in the wrong place. Jenkins uses the SYSTEM account to access files, but Unity doesn’t play nicely with this until version 2018.1.

To solve the problem setup two Environment Variables as seen below to point to the correct location for the files OR install unity 2018.1 which (apparently) has a fix in it. If you use the Environment variables then you’ll need to restart your PC before it’ll work.


Hope it helps


C# List Find and FindAll using Lambda

Find a list of things that have a given member set to a given value: –

List<Thing> foundThings = listOfThings.FindAll(x => x.member == searchParam);
if(foundThings.Count == 0)
    return false;

// Do something with the foundThings

Find a single thing that matches a given criteria: –

 Thing thing = listOfThings.Find(x => x.member == searchParam);
 if (thing == null)
   return false;

// Do something with the thing





Clamping dates in PHP

Needed to clamp a unix timestamp in PHP so I could use it for a database lookup. Quick source dump as follows: –

$time = date_create()->getTimeStamp(); // Get the initial timestamp
$mysqlDateTime = date("Y-m-d H:i:s", $time);
echo "Before: " . $mysqlDateTime . "<br />";

// Clamp to Minutes
$time = floor($time / 60) * 60;
$mysqlDateTime = date("Y-m-d H:i:s", $time);
echo "Clamp to Minutes: " . $mysqlDateTime . "<br />";

// Clamp to Hours
$time = floor($time / 3600) * 3600;
$mysqlDateTime = date("Y-m-d H:i:s", $time);
echo "Clamp to Hours: " . $mysqlDateTime . "<br />";

// Clamp to Days
$time = floor($time / 86400) * 86400;
$mysqlDateTime = date("Y-m-d H:i:s", $time);
echo "Clamp to Days: " . $mysqlDateTime . "<br />";

This gives the output: –

Before: 2018-02-03 23:45:24
Clamp to Minutes: 2018-02-03 23:45:00
Clamp to Hours: 2018-02-03 23:00:00
Clamp to Days: 2018-02-03 00:00:00