C
C#11mo ago
Ev4Y4n

Merge objects game

I'm trying to make a merge minigame but there's an error which I'm not able to fix. I've beentrying for days now.😫 If anyone knows how to solve this error I would greatly appreciate it.🙏
No description
No description
6 Replies
SinFluxx
SinFluxx11mo ago
It's saying the Length parameter you're passing to the Substring method (you're passing name.IndexOf("_")) cannot be less than 0. Which means that name.IndexOf("_") is returning a value <0, i.e, it's not finding any _ within name
Ev4Y4n
Ev4Y4nOP11mo ago
And why can this error occur? Because I've been looking for it for days but I can't find a solution.
SamwiseTheBrave
SamwiseTheBrave11mo ago
As SinFluxx has said, it doesn´t find '_' in the name. IndexOf returns index of first occurrence of character in string. If it doesn't find any, it returns -1.
Ev4Y4n
Ev4Y4nOP11mo ago
So I need to change the "_", right?
SamwiseTheBrave
SamwiseTheBrave11mo ago
you need to place it somewhere in your object's name because it doesn't seem to be present there
Ev4Y4n
Ev4Y4nOP11mo ago
Okay thank you both! I'm gonna try fix it.

Did you find this page helpful?