- Home /
C# Parent Transform Not Working?
I am trying to get a character to stay on a rotating platform by using a parenting script.
This is the C# script I am currently using: using UnityEngine; using System.Collections;
public class RotatingCollision : MonoBehaviour {
public Transform rotateTransform = RotatingPlatform.main.transform;
// Use this for initialization
void OnTriggerEnter (Collider other)
{
rotateTransform.parent = transform;
}
void OnTriggerExit (Collider other)
{
Transform.parent = null;
}
}
The script reference page says that this is the typical thing to write; but my program calls out the "rotatingTransform = RotatingPlatform.main.transform" and the "Transform.parent = null" as issues.
What am I doing wrong?
Answer by Jeremy2300 · Mar 20, 2014 at 02:18 AM
Just glanced at this but line 13 'Transform.parent' should probably be 'transform.parent' (they mean two different things).
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
C# Changing Force over Lifetime Through Script 2 Answers
Particles Speed? 2 Answers
Syncing particles 1 Answer
Modifying particle renderer material and assigning new particle emmitter 1 Answer