Skip to content

Instantly share code, notes, and snippets.

View walterpalladino's full-sized avatar

Walter H. Palladino walterpalladino

View GitHub Profile
@walterpalladino
walterpalladino / PersistenceManager.java
Last active November 16, 2017 05:08
Android Preferences Example
import android.content.Context;
import com.whp.android.SharedPreferencesDao;
import com.whp.android.serialization.SerializationUtils;
import java.io.IOException;
public class PersistenceManager {
/**
@walterpalladino
walterpalladino / RetroPhysicsObject.cs
Created February 12, 2018 00:24
Unity Retro 2D Platform Platform Controller
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RetroPhysicsObject : MonoBehaviour {
// Boundary control
[System.Serializable]
public class BoundaryControl
{
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum TypeOfFit
{
ScaleToFit = 0,
BestFit = 1
}
@walterpalladino
walterpalladino / ClickableUIObject.cs
Created July 10, 2018 13:57
Detect Taps on UI Elements
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems; // Required when using Event data.
public class ClickableUIObject : MonoBehaviour, IPointerDownHandler, IPointerUpHandler {
public bool clicked = false;
@walterpalladino
walterpalladino / AimingTorso.cs
Created July 10, 2018 14:22
Adding Torso Aim to 3d Model
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AimingTorso : MonoBehaviour {
[SerializeField]
private Transform spine;
[SerializeField]
private float rotationScale = 1.0f;
@walterpalladino
walterpalladino / GameManager.cs
Created July 11, 2018 00:09
GameManager example
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameManager : MonoBehaviour {
private static GameManager instance;
public static GameManager Instance { get { return instance; } }
@walterpalladino
walterpalladino / Open Unity 16-9.scpt
Created October 18, 2018 16:36
How to Open the Unity Window on Mac OS X on a 16:9 relationship (1280x720)
tell application "Unity" to activate -- needs to be in front
tell application "System Events" to tell application process "Unity"
try
get properties of window 1
set size of window 1 to {1280, 720}
on error errmess
log errmess
-- no window open
end try
end tell
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MonoObject : MonoBehaviour
{
private PureClass pc;
// Start is called before the first frame update
void Start()
@walterpalladino
walterpalladino / CameraFacingBillboard.cs
Created April 15, 2021 20:22
Unity 3D Billboard scripts
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//[ExecuteInEditMode]
public class CameraFacingBillboard : MonoBehaviour {
[SerializeField]
private Camera referenceCamera;
@walterpalladino
walterpalladino / BillboardFacingY.cs
Created April 15, 2021 20:23
Unity 3D Billboard only facing Y to camera
using UnityEngine;
public class BillboardFacingY : MonoBehaviour
{
void Update()
{
// look at camera...
transform.LookAt(Camera.main.transform.position, -Vector3.up);
// then lock rotation to Y axis only...
transform.localEulerAngles = new Vector3(0,transform.localEulerAngles.y,0);