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.🙏
6 Replies
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
And why can this error occur? Because I've been looking for it for days but I can't find a solution.
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.So I need to change the "_", right?
you need to place it somewhere in your object's name
because it doesn't seem to be present there
Okay thank you both! I'm gonna try fix it.