31 lines
776 B
C#
31 lines
776 B
C#
|
|
|||
|
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
namespace Thousandto.SkillEditor.Support
|
|||
|
{
|
|||
|
public class EditorVFXLoader
|
|||
|
{
|
|||
|
public static EditorVFXScript Load(string path)
|
|||
|
{
|
|||
|
if (string.IsNullOrEmpty(path))
|
|||
|
return null;
|
|||
|
|
|||
|
var obj = Resources.Load(path) as GameObject;
|
|||
|
|
|||
|
if (obj != null)
|
|||
|
{
|
|||
|
GameObject result = GameObject.Instantiate(obj) as GameObject;
|
|||
|
var script = result.GetComponent<EditorVFXScript>();
|
|||
|
if(script == null)
|
|||
|
{
|
|||
|
script = result.AddComponent<EditorVFXScript>();
|
|||
|
}
|
|||
|
script.gameObject.SetActive(true);
|
|||
|
return script;
|
|||
|
}
|
|||
|
return null;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|