Пример #1
0
        public static ParticleInfo[] CreateParticleInfo(string assetPath)
        {
            if (!EditorPath.IsPrefab(assetPath))
            {
                return(null);
            }

            GameObject prefab = AssetDatabase.LoadAssetAtPath <GameObject>(assetPath);

            ParticleSystem[] particleSystem = prefab.GetComponentsInChildren <ParticleSystem>();
            ParticleInfo[]   particleInfo   = new ParticleInfo[particleSystem.Length];

            for (int i = 0; i < particleSystem.Length; i++)
            {
                particleInfo[i]              = new ParticleInfo();
                particleInfo[i].Path         = assetPath;
                particleInfo[i].RealPath     = assetPath + "/" + ViewerConst.GetPath(particleSystem[i].transform);
                particleInfo[i].MaxParticles = particleSystem[i].main.maxParticles;
                particleInfo[i].Duration     = particleSystem[i].main.duration;
                particleInfo[i].PlayOnAwake  = particleSystem[i].main.playOnAwake;
                particleInfo[i].Looping      = particleSystem[i].main.loop;
            }

            return(particleInfo);
        }