예제 #1
0
        private void SaveValue(T value)
        {
            try {
                if (value is bool)
                {
                    EditorPrefs.SetBool(Key, (bool)(object)value);
                }

                else if (value is int || value is Enum)
                {
                    EditorPrefs.SetInt(Key, (int)(object)value);
                }

                else if (value is float)
                {
                    EditorPrefs.SetFloat(Key, (float)(object)value);
                }

                else if (value is string)
                {
                    EditorPrefs.SetString(Key, (string)(object)value);
                }

                else if (value is Color || value is Vector2 || value is Vector3 || value is Vector4)
                {
                    EditorPrefs.SetString(Key, GetSerializedString(SerializableVector.GetVectorFromObject(value)));
                }

                else
                {
                    EditorPrefs.SetString(Key, GetSerializedString(value));
                }
            }
            catch (Exception e) {
                Debug.LogWarning(string.Format("Failed to save {0}: {1}", Key, e));
            }
            finally {
                _value = value;
            }
        }
예제 #2
0
 public LayerColor(int layer, Color color)
 {
     this.layer = layer;
     this.color = color;
 }