- Home /
'ParticleSystem' does not contain a definition for 'Play'
Hey, sorry to bother you with that but I'm really troubled.
I've done a basic ParticleSystem tutorial on YT, wich plaus well in the editor. But for some reason I can't get to start the animation from my Script...
This might come from Visual Studio that crushes the imports and stuff, but here's my code :
using UnityEngine;
using TMPro;
namespace Namespace.Scoreboards
{
public class ScoreboardEntryUI : MonoBehaviour
{
[SerializeField] private TextMeshProUGUI entryNameText = null;
[SerializeField] private TextMeshProUGUI entryScoreText = null;
private ParticleSystem particleEffect;
public void Initialize(ScoreboardEntryData scoreboardEntryData)
{
entryNameText.text = scoreboardEntryData.entryName;
entryScoreText.text = scoreboardEntryData.entryScore.ToString();
particleEffect = GetComponent<ParticleSystem>();
particleEffect.Play();
}
}
}
This script is attached to a Game prefab, wich has the so-called Particle system.
I get the error in console : Assets\Scripts\ScoreboardEntryUI.cs(19,28): error CS1061: 'ParticleSystem' does not contain a definition for 'Play' and no accessible extension method 'Play' accepting a first argument of type 'ParticleSystem' could be found (are you missing a using directive or an assembly reference?)
I have no idea how the compiler can not get the Play() function from ParticleSystem. Am I missing something ?
Thanks !
Answer by ArmandLot · Jun 03, 2020 at 09:41 AM
FOUND ANSWER: Okay so for some reason (I'm looking at you MS Visual Studio), a script named ParticleSystem.cs
was created inside my Script folder, and it didn't had a function named Play()
obviously.
Solution was to delete that script, so that UnityEngine.ParticleSystem wasn't override by my script ;)
Answer by Doxy95_ · Sep 23, 2020 at 12:31 PM
i have the same problem and i have a script named ParticleSystem.cs but when i changed its name the error still :/
Your answer
![](https://koobas.hobune.stream/wayback/20220612235736im_/https://answers.unity.com/themes/thub/images/avi.jpg)