private void CreateInstanceTile()
        {
            var      t            = m_Tile.GetType();
            RuleTile instanceTile = CreateInstance(t) as RuleTile;

            instanceTile.hideFlags = HideFlags.NotEditable;
            instanceTile.name      = m_Tile.name + " (Override)";
            m_InstanceTile         = instanceTile;

#if UNITY_EDITOR
            if (AssetDatabase.Contains(this))
            {
                AssetDatabase.AddObjectToAsset(instanceTile, this);
            }
            EditorUtility.SetDirty(this);
#endif
        }
Example #2
0
        public void OnEnable()
        {
            if (m_Tile == null)
            {
                return;
            }

            if (m_InstanceTile == null)
            {
                var      t            = m_Tile.GetType();
                RuleTile instanceTile = ScriptableObject.CreateInstance(t) as RuleTile;
                instanceTile.hideFlags = HideFlags.NotEditable;
                instanceTile.name      = m_Tile.name + " (Override)";
                m_InstanceTile         = instanceTile;
                Override();

#if UNITY_EDITOR
                AssetDatabase.AddObjectToAsset(instanceTile, this);
                EditorUtility.SetDirty(this);
#endif
            }
        }