public static YamlUnityObject Create(string type) { YamlUnityObject obj = null; switch (type) { case "GameObject": obj = new YamlGameObject(); break; case "Transform": obj = new YamlTransform(); break; case "ParticleSystem": obj = new YamlParticleSystem(); break; //--其他的不管了 } if (obj != null) { obj.TypeName = type; } return(obj); }
public void Modify() { var yamlPrefab = YamlPrefabUtil.CreateWithPrefab(Target); YamlParticleSystem ps = yamlPrefab.FinGameObject("P2").GetComponment <YamlParticleSystem>(); ps.MainModule.StartColor.Apply(DataSource.StartColor.GetData()); ps.MainModule.StartSize.Apply(DataSource.StartSize.GetData()); string path = yamlPrefab.GetPrefabAssetPath(); Debug.LogWarning("save to ===> " + path); yamlPrefab.Save(path); }