Attaching Prefeb effect issue

Hi all, I am very new here and I am not sure if I am posting in the correct place. But I am currently making a puzzle game and I built a prefab edge glow for when the piece locks into place the edges emit. I attached the prefab to Edge Particles and I typed C# so that it should only react once the puzzle piece connects to it’s place. When I run it nothing happens once the piece locks into place. Please see the code below I used and the screenshot of where I attached the prefab.

I hope someone can help. Let me know if you need further details.5356503--541359--upload_2020-1-10_6-55-25.png



5356503--541359--upload_2020-1-10_6-55-25.png

Hi,

my suggestion is to pause the game right after the piece locks. Then checkout the scene view and see if the edgeglow was actually spawned. Select it and try to find out why you don’t see it. Maybe it is rotated wrong or really small or the particle effect does not start automatically.
If you are unsure whether a piece of code is executed when you would expect, try to add a Debug.Log("some text"); statement.
By the way, are there any errors in your console?

Also, on an entirely different note, do you know enums? Try this:

public enum PieceStatus {
    Unlocked,
    Locked
}

public PieceStatus pieceStatus = PieceStatus.Unlocked;

this is better than using strings for status, because with strings it is easy to make a typo. Also, your initial pieceStatus of an empty string has an unclear meaning. With enums, the status must be one of the defined ones. If it is only a question of locked/unlocked, though, you should use a bool instead.

Happy Unitying!