{"action":"opened","issue":{"url":"https://api.github.com/repos/jacobdufault/fullinspector/issues/107","labels_url":"https://api.github.com/repos/jacobdufault/fullinspector/issues/107/labels{/name}","comments_url":"https://api.github.com/repos/jacobdufault/fullinspector/issues/107/comments","events_url":"https://api.github.com/repos/jacobdufault/fullinspector/issues/107/events","html_url":"https://github.com/jacobdufault/fullinspector/issues/107","id":57047773,"number":107,"title":"Properties may not be instanced at OnValidate or Awake","user":{"login":"smmathews","id":444056,"avatar_url":"https://avatars.githubusercontent.com/u/444056?v=3","gravatar_id":"","url":"https://api.github.com/users/smmathews","html_url":"https://github.com/smmathews","followers_url":"https://api.github.com/users/smmathews/followers","following_url":"https://api.github.com/users/smmathews/following{/other_user}","gists_url":"https://api.github.com/users/smmathews/gists{/gist_id}","starred_url":"https://api.github.com/users/smmathews/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smmathews/subscriptions","organizations_url":"https://api.github.com/users/smmathews/orgs","repos_url":"https://api.github.com/users/smmathews/repos","events_url":"https://api.github.com/users/smmathews/events{/privacy}","received_events_url":"https://api.github.com/users/smmathews/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-09T15:47:59Z","updated_at":"2015-02-09T15:47:59Z","closed_at":null,"body":"we have an issue where instanced properties will sometimes be null in OnValidate or Awake, when they are later filled in with the data the designer has set in the editor. How would you suggest validating this data for errors?\r\n\r\n[Serializable]\r\npublic abstract class LocationData  {\r\n    public abstract CheckData(BaseBehavior behavior);\r\n}\r\n[Serializable]\r\npublic class CityLocationData : LocationData {\r\n    public BuildingData building { get; private set;}\r\n    public override CheckData(BaseBehavior behavior) {\r\n        if(building == null)\r\n            building.LogError(\"no building data has been specified\",behavior);\r\n}\r\npublic class MapPoint : BaseBehavior<FullInspector.FullSerializerSerializer> {\r\n    public LocationData locationData;\r\n    public void OnValidate() {\r\n        if(locationData == null)\r\n            Debug.LogError(\"locationData has not been instantiated\",this);\r\n        else\r\n            locationData.CheckData(this);\r\n    }\r\n}"}}