Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Elapse on March 28, 2018, 08:28:42 AM
-
Hi there,
I want to change the Buttons scale in two ways in different situations. For one way it works fine:
//when I start the menu
//position changes aswell
TweenScale tweenS = prefab.GetComponent<TweenScale>();
tweenS.from = Vector3.zero;
tweenS.to = Vector3.one; <-----why Vector3(1,1,1) instead leads to an error? how to fix it?
tweenS.PlayForward();
The Problem is, that I need to change the values to Vector3(1.5, 1.5, 1.5) for the next way. The Unity API says that Vector3.one is just a short version of Vector3(1,1,1). I'm confused.
Thanks for help and have a good day. Marten
-
Zero is an invalid scale. You can't divide by zero, so inverse transform can't be calculated. You're shooting yourself in the foot whenever you use a zero scale. Consider changing it to 0.001 instead.
Your question is also not an NGUI question, and not even a Unity question, but a basic C# question. In C# you need to prefix new object declarations with a "new".
-
Thanks for "taping" :)
I wonder, why it works then, but I'll change it and try fading them out and in instead.