Is it possible to automacicaly random rotate pefab during placement in editor in unity 4.5.3?
I can make it autorotate in game(at start) but I want it to be visible in editor and at fixed rotation after placement.
Found it!
Attribute [ExecuteInEditMode] does what I want
[ExecuteInEditMode]
public class RandomRotation : MonoBehaviour {
void Start () {
#if UNITY_EDITOR
this.transform.Rotate(0, MyRandom.Rotate(this.GetInstanceID()), 0);
this.transform.localScale = MyRandom.Scale (this.GetInstanceID(), 0.4f, 1f);
Debug.Log("Editor");
#else
Debug.Log("Game");
#endif
}
}