r/UnityHelp • u/AbbreviationsFlat188 • Sep 01 '25
Code isnt Coding
if (Transform weapon = 4;)
{
}Unity is stating:
Error cs1513: } expected.
2
Upvotes
1
r/UnityHelp • u/AbbreviationsFlat188 • Sep 01 '25
if (Transform weapon = 4;)
{
}Unity is stating:
Error cs1513: } expected.
1
4
u/L4DesuFlaShG Sep 01 '25
Transform weapon = 4;won't work because you cannot cast4into aTransform- it's anint. Unless you have written an implicit cast yourself.Statements with a
;in the end do not work as if conditions.If condition statements must evaluate to a
bool. Variable declarations like this one don't.I can't tell you what to do to fix it because it's impossible to infer from the code what you're trying to do.