Only the very first if statement actually works
if (checkRailHitLeft.collider.name == "leftcurveleft")
{
Debug.Log("leftcurveleft");
}
if (checkRailHitRight.collider.name == "leftcurveright")
{
Debug.Log("leftcurveright");
}
In this scenario, when all conditions are met, only the if statement at the top actually fires. As is, only "leftcurveleft" logs. When you flip the statements, "leftcurveright" logs, but not the other one. This is the actual code, I stripped it down completely to isolate the issue.
Shouldn't if statements always fire if there's no "else" in there? Both raycasts are functional (otherwise it wouldn't work with flipped ifs), but in this situation only one actually gets to do anything done.
should work, will be a typo or something causing your problem
Answer by G4merSylver · Dec 14, 2015 at 06:31 PM
Could it be that the remains of the code only allow you interact with just one side? Perhaps both raycasts somehow ended up into merging into one because you misplaced it at one point?