Reputation: 353
I am creating a game which involves scaling the game object and I only want it to have positive values for its Vector3.
How can I do that?
Upvotes: 1
Views: 1081
Reputation: 4049
You can listen for the OnValidate message like this:
private void OnValidate ( )
{
if ( ScaleFactor.x < 0 ) ScaleFactor.x = 0;
if ( ScaleFactor.y < 0 ) ScaleFactor.y = 0;
if ( ScaleFactor.z < 0 ) ScaleFactor.z = 0;
}
Here's the official documentation.
Upvotes: 1