- Home /
Question by
GonzaloGonzo · Nov 14, 2016 at 07:34 AM ·
parentchildreferencingheritage
trying to access to a variable (m_GravityMultiplier) of the FirstPersonController script from a Child of the FPSController
I have a Cube that it's child of FPSController and depending of a change in the rotation of this cube i want to manipulate the "GravityMultiplier" from the FirstPersonController Script. How can I make a reference to it and change it during run time?
This is my code so far...
using UnityEngine; using System.Collections; using UnityStandardAssets.Characters.FirstPerson;
public class paracaidas : MonoBehaviour {
public GameObject FPS;
public GameObject Cubo;
void Start () {
FPS = GameObject.Find ("FPSController").GetComponent<FirstPersonController> ();
}
// Update is called once per frame
void Update () {
if (Cubo.transform.eulerAngles.x >= 70) {
}
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612100602im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Make a simple tree 1 Answer
Getting variable data from Parent 1 Answer
How do I find a child object in a hierarchy of children? 1 Answer
Removing specific child objects 1 Answer