Skip to content

Instantly share code, notes, and snippets.

View karimkod's full-sized avatar
⌨️
*Keyboard clicks*

Bourennane Abdelkrim karimkod

⌨️
*Keyboard clicks*
View GitHub Profile
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Interpolator : MonoBehaviour
{
[Range(0,1)]
[SerializeField] private float interpolationParam;
[SerializeField] private Vector3 destinationPosition;
@karimkod
karimkod / WWWFormAddFieldsFromObject.cs
Last active January 5, 2020 14:46
An extension method for WWWForm to add fields from public fields of an instance of a class
using System.Reflection;
using System;
using UnityEngine;
public static class WWWFormExt{
public static void AddFieldsFromObject<T>(this WWWForm form, T sourceObject)
{
var serializableAttr = Attribute.GetCustomAttribute(sourceObject.GetType(), typeof(SerializableAttribute));
var type = typeof(T);