I’m trying to control an objects X and Z using 2 sliders (1 for each value).
It worked fine using the script for X, but when using the script for Z nothing happens. Both are applied to the object and both “AdjustWidth” and “AdjustHeight” are added to the slider value.
Code for X:
using UnityEngine;
using System.Collections;
public class Gulv_bredde : MonoBehaviour
{
// Use this for initialization
public float gulvBredde = 1f;
void Start()
{
}
public void AdjustWidth(float nyBredde)
{
gulvBredde = nyBredde;
}
// Update is called once per frame
void Update()
{
transform.localScale = new Vector3(1f+gulvBredde, 0.25f, 1f);
}
}
Code for Y:
using UnityEngine;
using System.Collections;
public class GulvLengde : MonoBehaviour
{
// Use this for initialization
public float gulvLengde = 1f;
void Start()
{
}
public void AdjustHeight(float nyLengde)
{
gulvLengde = nyLengde;
}
// Update is called once per frame
void Update()
{
transform.localScale = new Vector3(1f, 0.25f, 1f+gulvLengde);
}
}
Any help is appreciated!