summaryrefslogtreecommitdiff
path: root/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVariable.cs
blob: c6d3eaf2acdccd2da3d0b053112297f21d340a7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Amplify Shader Editor - Visual Shader Editing Tool
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>

using UnityEngine;
using System;

namespace AmplifyShaderEditor
{
	//GENERICS DON'T WORK WITH HOT CODE RELOAD
	[Serializable]
	public class FallbackVariable<T>
	{
		[SerializeField]
		private T m_current;
		[SerializeField]
		private T m_last;

		public void Revert()
		{
			m_current = m_last;
		}

		public T Current
		{
			get
			{
				return m_current;
			}
			set
			{
				m_last = m_current;
				m_current = value;
			}
		}
	}
}