i have a problem that i don't understand why is happenning and it's driving me mad. I'm trying to code a script to put the player in the car by disabling the third person controller and then Transform.SetParent. Here's the code:
public ThirdPersonCharacterControl Controller;
public GameObject Player;
public GameObject Car;
public void PutWheel()
{
if(isInteractive)
{
if(isCar)
{
PlacePlaceables();
Controller.enabled = false;
Player.transform.SetParent(Car);
}
}
}
The error is:
Assets/Scripts/Player/Interactible.cs(361,34): error CS1502: The best overloaded method match for `UnityEngine.Transform.SetParent(UnityEngine.Transform)' has some invalid arguments
Assets/Scripts/Player/Interactible.cs(361,44): error CS1503: Argument `#1' cannot convert `UnityEngine.GameObject' expression to type `UnityEngine.Transform'
Why is that happening? It doesn't make sense to me because everything seems correct.