Hello.
I have a little problem with my game object. I want to have a couple of child objects and this childs should be buttons. In specify: if I have 2 cubes and I click on one of them 2 buttons should appear (childs of this cube) and when I clik on another one for example 3 buttons should appear (another buttons). The problem is when I add a buttons as childs they move and rotate with parent. I added following code to button:
void Start () {
rotation = transform.rotation;
position = transform.position;
}
// Update is called once per frame
void Update () {
transform.rotation = rotation;
transform.position = position;
}
This code only prevent buttons to not move but they still rotate. Is there any other way to prevent this child buttons form moving and rotating with their parent? Thank you very much for your help