Skip to content

Instantly share code, notes, and snippets.

View GregLukosek's full-sized avatar

Greg Lukosek GregLukosek

  • Bedford
View GitHub Profile
void App::OnLaunched(LaunchActivatedEventArgs^ e)
{
m_SplashScreen = e->SplashScreen;
InitializeUnity(e->Arguments);
//these two lines
auto av = Windows::UI::ViewManagement::ApplicationView::GetForCurrentView();
av->SetDesiredBoundsMode(Windows::UI::ViewManagement::ApplicationViewBoundsMode::UseCoreWindow);
}
$ adb logcat
and it will start printing out everything that is going on on the device. To limit it to only show the output from inside Unity, you can try this:
$ adb logcat -s Unity
or, to get a little bit more info about what's going on:
$ adb logcat -s Unity ActivityManager PackageManager dalvikvm DEBUG
@GregLukosek
GregLukosek / GetCombinedBounds
Last active September 1, 2016 14:22
Get bounds of Unity Renderer and all its children
public Bounds GetCombinedBounds(GameObject parent) {
Bounds combinedBounds = new Bounds();
//grab all child renderers
Renderer[] renderers = GetComponentsInChildren<Renderer>(GetComponent<Renderer>());
//grow combined bounds with every children renderer
foreach (Renderer rendererChild in renderers) {
@GregLukosek
GregLukosek / TexturePostProcessor
Last active May 23, 2023 05:12
Custom Texture Importer for Unity
//Greg Lukosek 2015
//[email protected]
using UnityEngine;
using UnityEditor;
public class TexturePostProcessor : AssetPostprocessor
{
void OnPostprocessTexture(Texture2D texture)
extension Int {
var ordinal: String {
get {
var suffix: String = ""
var ones: Int = self % 10;
var tens: Int = (self/10) % 10;
if (tens == 1) {
suffix = "th";
} else if (ones == 1){
@GregLukosek
GregLukosek / gist:6dd2149e5d069f2538c8
Created March 9, 2015 15:48
Sorting NSDictionary by string date value
let rates = responseDictionary["rates"] as NSDictionary
let stringArray = rates.allKeys as [String]
var dates = Array<NSDate>()
for s in stringArray {
dates.append(dateFormater.dateFromString(s)!)
}
dates.sort({$0.timeIntervalSinceNow < $1.timeIntervalSinceNow})
@GregLukosek
GregLukosek / gist:4abccb2594a89b78d934
Created March 6, 2015 09:35
Find Lowest and highest value in CGFloat Array
var data: [CGFloat] = [10, 50, 20, 5, 5, 10]
let minValue = data.reduce(data[0], { min($0, $1) })
let maxValue = data.reduce(data[0], { max($0, $1) })
@GregLukosek
GregLukosek / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@GregLukosek
GregLukosek / UIDevice extension
Created January 13, 2015 16:13
Swift Check device and system version
import UIKit
// Usage example:
// let deviceType : DeviceTypes = UIDevice().deviceType
// let deviceName : String = deviceType.rawValue
public enum DeviceTypes : String {
case simulator = "Simulator",
iPad2 = "iPad 2",
dispatch_async (dispatch_get_main_queue (),
{
// sume code here
()
});