Created
February 10, 2018 02:47
-
-
Save lynxelia/b2f303c3732a877594a12782fca90d46 to your computer and use it in GitHub Desktop.
Example for garbage collection bug when setting a component field during OnValidate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[RequireComponent(typeof(Rigidbody2D))] | |
public class Example : MonoBehaviour | |
{ | |
void OnValidate() | |
{ | |
GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Dynamic; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment