Пример #1
0
            public static GameObject Clone(string prefabName, string instanceId = null)
            {
                try
                {
                    EffectParameters.GetEffectNameAndParameters(ref prefabName, out string parameters);

                    GameObject original = Get(prefabName);
                    if (original == null)
                    {
                        return(null);
                    }

                    GameObject prefab = UnityEngine.Object.Instantiate(original);
                    if (prefab == null)
                    {
                        return(null);
                    }

                    EffectParameters.ApplyAfterCreation(prefab, parameters);

                    if (instanceId != null)
                    {
                        Instances.Add(instanceId, prefab);
                    }

                    //Log.Debug($"UnityEngine.Object.DontDestroyOnLoad(prefab);");
                    //UnityEngine.Object.DontDestroyOnLoad(prefab);
                    return(prefab);
                }
                catch (Exception ex)
                {
                    Log.Exception(ex);
                    return(null);
                }
            }
Пример #2
0
 public static GameObject CreateKnownEffect(string effectName, string instanceId = null)
 {
     if (KnownEffectsBuilder != null)
     {
         EffectParameters.GetEffectNameAndParameters(ref effectName, out string parameters);
         GameObject result = KnownEffectsBuilder.Create(effectName, instanceId);
         EffectParameters.ApplyAfterCreation(result, parameters);
         return(result);
     }
     else
     {
         Talespire.Log.Error($"KnownEffectsBuilder == null!!!");
     }
     return(null);
 }