Question by
EcceHomo · Aug 06, 2016 at 12:55 AM ·
gameobjectraycasttransformraycasthit2dmoving platform
Multiple game objects same script
I have multiple platfforms with same script MovingPlatform.cs.
My problem is that when one platform (game object) is on scene everything is ok, but when I have more objects, script is setting player.transform.parent to null even if I raycast with one of the platforms.
if (_controller.RayCasting())
{
player.transform.parent = transform;
}
else
{
player.transform.parent = null;
}
How to stop this from happening and have same behavior as with only one platform on scene!?
Comment
Your answer
Follow this Question
Related Questions
When I Raycast Hit Object set to fixed hand position. 1 Answer
Null reference exception, even though I want my method to return null 0 Answers
Add GameObject Raycast hits to a variable 1 Answer
How would I project a Gameobject onto the surface of another? 0 Answers
Operator '==' is ambiguous on operands of type 'Vector2' and 'Vector3' 1 Answer