In the game i am currently working on i have a train system that serves to take the player across an island, the train is moving on a loop through the animation system, the problem is the player wont stay on the train i have tried everything from coliders to fixed joints nothing seems to work this is the current code of the train:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class train_board_confusion : MonoBehaviour {
public GameObject train;
public GameObject item;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void FixedUpdate () {
item.transform.parent = train.transform;
}
void OnTriggerEnter(Collider other)
{
item = other.gameObject;
}
}
the current error is saying it cant change the parent of a prefab, please help im relatively new to game development and c# so im probably missing something stupid.