omid3098 / OpenFlowMap

MIT License
99 stars 7 forks source link

Let OpenFlowmapBehaviour do the baking instead of OpenFlowmapConfig #9

Closed fight4dream closed 11 months ago

fight4dream commented 11 months ago

During opening unity project, it might cause errors and crashes due to calling OnValidate() on config (and processors) but there may be no valid scene to make the raycasts. Because OpenFlowmapBehaviour is inside a scene, it makes more sense for the behaviour to initilize the baking instead of the Config.

Solution: Move the rayprojector and baking code into OpenFlowmapBehaviour. then config OnValidate will try to find the behaviour in scene that uses the config and call its initialize. the processor's OnValidate will call config.OnValidate (which in turn will find behvaiour in scene)

fight4dream commented 11 months ago

Also, the behaviour should bear the responsibility of current FlowmapRenderer because it is the actual baking process. So, config processor array should not contain FlowmapRenderer and we will remove it