Skip to content

Instantly share code, notes, and snippets.

@adamgit
adamgit / gist:42253d7bb9320bbb49bf
Last active August 29, 2015 14:16
Unity3d: track a variable live in your GUI using drag/drop and Inspector (don't write a pointless class every time you need this)
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Reflection;
/**
License: do whatever you want.
Questions etc: @t_machine_org
*/
@adamgit
adamgit / gist:3839993
Created October 5, 2012 14:11
VCLoadApplication method swizzle
@implementation UIView (swizzled)
-(void) swizzledSetNeedsDisplay
{
//if( _currentFrame != _lastDrawnFrame )
{
//[super setNeedsDisplay];
}
}
@end
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Function;
public class ProcPhysicsSetVelocities
{
import tmachine.batchprocessors.MBExecutableAlgorithm;
import java.text.DecimalFormat;
import java.util.LinkedList;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Function;
/**
* Created by adam on 29/03/16.
public interface MBExecutableAlgorithm<T>
{
public void execute( T dataSet );
}
@adamgit
adamgit / UnityTweakGUI.cs
Last active June 10, 2016 21:21 — forked from Danik/UnityTweakGUI.cs
A simple in-game parameter tweaking script for Unity. It finds all fields and properties marked with [TweakableMember] in MonoBehaviours in a scene, and enables tweaking in a GUI from inside the game, which can be useful on tablets etc, where there is no access to the inspector.
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
///<summary>
/// A simple in-game GUI for Unity that allows tweaking of script fields
/// and properties marked with [TweakableMember]
///</summary>
@adamgit
adamgit / PackageSettings.cs
Created February 14, 2022 16:08
A generic solution for storing and retrieving per-Project settings in Unity seamlessly whether in a Package, a Project, or a DLL.
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor.Compilation;
using UnityEngine;
using Assembly = System.Reflection.Assembly;
public class PackageSettings : ScriptableObject
using System;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEditor;
public class GizmoRendererAttribute : System.Attribute
{
@adamgit
adamgit / GlobalUnityEnumUpdater.cs
Created August 18, 2024 19:27
Globally converts all (impossible, deleted) values of a specific enum to (new, correct / updated) values
public class UpdateableMyStruct
{
public Func<MyStruct> getter;
public Action setter;
public string attribute;
public string ownerName;
}
public class ProposedChanges
@adamgit
adamgit / gist:3705459
Last active December 17, 2024 00:14
Automatically create cross-platform (simulator + device) static libraries for Objective C / iPhone / iPad
##########################################
#
# c.f. http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4
#
# Version 2.82
#
# Latest Change:
# - MORE tweaks to get the iOS 10+ and 9- working
# - Support iOS 10+
# - Corrected typo for iOS 1-10+ (thanks @stuikomma)