You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
750 B
34 lines
750 B
using UnityEngine; |
|
using UnityEditor; |
|
using System.Collections; |
|
|
|
namespace Fungus |
|
{ |
|
|
|
public class SpriteMenuItems |
|
{ |
|
[MenuItem("GameObject/Fungus/Sprite/ParallaxSprite")] |
|
static void CreateParallaxSprite() |
|
{ |
|
InstantiatePrefab("ParallaxSprite"); |
|
} |
|
|
|
[MenuItem("GameObject/Fungus/Sprite/ClickableSprite")] |
|
static void CreateClickableSprite() |
|
{ |
|
InstantiatePrefab("ClickableSprite"); |
|
} |
|
|
|
static void InstantiatePrefab(string prefabName) |
|
{ |
|
GameObject prefab = Resources.LoadAssetAtPath("Assets/Fungus/Sprite/Prefabs/" + prefabName + ".prefab", typeof(GameObject)) as GameObject; |
|
if (prefab != null) |
|
{ |
|
GameObject go = PrefabUtility.InstantiatePrefab(prefab) as GameObject; |
|
go.name = prefabName; |
|
} |
|
} |
|
|
|
} |
|
|
|
} |