[Serializable] public class ClassData{.......
using System;
using System.IO;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters.Binary;
public static class ExtensionMethods{
public static T DeepClone<T>(this T a){
using (MemoryStream stream = new MemoryStream()){
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(stream, a);
stream.Position = 0;
return (T) formatter.Deserialize(stream);
}
}
}
DictionaryPlayer = DictionaryBase.DeepClone();
Debug.Log("1 => " + DictionaryBase["Name"].Test);
Dictionary<string, ClassData> DictionaryPlayer = new Dictionary<string, ClassData>(DictionaryBase);
DictionaryPlayer["Name"].Test= 2;
Debug.Log("2 => " + DictionaryBase["Name"].Test);
1 => 1
2 => 2
double test = 0.0029999999;
Debug.Log(test);
test = Math.Round(test, 4);
Debug.Log(test);
float test = 0.0029999999f;
test = Math.Round(test, 4);
Debug.Log(test);
Cannot implicitly convert type 'double' to 'float'. An explicit conversion exists (are you missing a cast?)
float test = 0.0029999999f;
Math.Round(test, 4);
Debug.Log(test);