Files
Main/Assets/SkillEditor/Script/VFX/EditorVFXLoader.cs

31 lines
776 B
C#
Raw Permalink Normal View History

2025-01-25 04:38:09 +08:00

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;
}
}
}