Пример #1
0
    CreateSprite()
    {
        var go = new GameObject("New Sprite");

        go.AddComponent <SsSprite>();
        // add shader keeper to current scene if it doesn't exist.
        SsAssetPostProcessor.AddShaderKeeperToCurrentScene();
        return(go);
    }
Пример #2
0
//	public void OnHierarchyChange()
//	{
//		Debug.LogWarning("OnHierarchyChange()");
//		AddShaderKeeper();
//	}

//	public void OnSelectionChange()
//	{
//		Debug.LogWarning("OnSelectionChange()");
//		AddShaderKeeper();
//	}

    static public void AddShaderKeeper()
    {
        // if null or not changed or prefab is ignored.
        if (!SsSpriteEditor.LastSprite)
        {
            return;
        }
        if (SsSpriteEditor.LastSprite == _lastSprite)
        {
            return;
        }
        if (PrefabUtility.GetPrefabType(SsSpriteEditor.LastSprite.gameObject) == PrefabType.Prefab)
        {
            return;
        }

        // it seems to be added new sprite possibly...
        _lastSprite = SsSpriteEditor.LastSprite;
        //Debug.Log("sprite added to this scene!!" + _lastSprite);

        // add shader keeper to current scene if it doesn't exist.
        SsAssetPostProcessor.AddShaderKeeperToCurrentScene();
    }