Guest User

Untitled

a guest
Feb 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. [RequireComponent(typeof(Rigidbody2D))]
  2. public class MyCustomClass : BaseMonoBehaviour
  3. {
  4. public bool m_CanMove;
  5.  
  6. public override bool OnValidateProperty(string propertyName)
  7. {
  8. if (propertyName == "m_CanMove")
  9. {
  10. if (!m_CanMove)
  11. {
  12. GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Static;
  13. return true;
  14. }
  15. }
  16.  
  17. return base.OnValidateProperty(propertyName);
  18. }
  19. }
Add Comment
Please, Sign In to add comment