When I call a script that uses GetComponentInParent from a custom inspector via a button, it returns null, while calling the same script at runtime returns the component.
Is this as intended?
When I call a script that uses GetComponentInParent from a custom inspector via a button, it returns null, while calling the same script at runtime returns the component.
Is this as intended?
By default, all Mono Behaviours are only executed in play mode. so if you want to get a script that inherits Mono behaviour class , it doesn’t work in editor mode without adding
[ExecuteInEditMode] above your script.just add [ExecuteInEditMode] above your script