Question by
Im-Brazilian · Oct 15, 2016 at 08:33 PM ·
javascriptscalevariableslocalscalefunction update
How can I make A Object have the same Scale as B Object?
I want the "Ghost" Transform have the same Scale as "prefabSelecionado", but The prefabSelecionado is a private Transform (I don't know if it matters), I tried a lot of ways as localScale, lossyScale, mesh bounds, but I can't make this works >:( I want to do something like this:
private var prefabSelecionado : Transform;
var Ghost : Transform; // The code is already attached to it
var doorPrefab : Transform;
var wallPrefab : Transform;
function Start(){
}
function Update (){
//It have to be on Javascript, because it's a very huge code
Ghost.transform.localScale = prefabSelecionado.localScale; // <--- This is my error
// When it changes :
if(Input.GetKeyDown(KeyCode.Alpha1)){
prefabSelecionado = wallPrefab;
}
if(Input.GetKeyDown(KeyCode.Alpha2)){
prefabSelecionado = doorPrefab;
}
[much more code in function Update]
}
I'll convert this to C# soon. Sorry if it had any english grammar mistake.
Comment