Avindr / MxM-IssueTracking

7 stars 0 forks source link

TrajectoryGeneratorModule contains camera reference which does not make much sense for scriptable objects. #170

Closed freyzor closed 1 year ago

freyzor commented 1 year ago

If you use trajectory gen modules to swap between modes it will set you camera to null and brake the trajectory generation as a scriptable object asset can not reference scene objects. The only use case for having camera in the module is if you are assigning the camera on runtime. I had to apply a workaround and added a null check when assigning the camera module in MxMTrajectoryGenerator. SetTrajectoryModule. I think it's fair to expect camera switches to be handled separately.

I also noticed that m_trajectoryGeneratorModule does not get assigned when SetTrajectoryModule is called causing confusion when I did not see my module updated in the inspector on runtime. It's only ever used when initializing so it's not much on an issue as you can access it externally but it was unexpected. It might make sense to assign it and expose the current module in case you would want to cache and alter the assigned module at runtime.

Avindr commented 1 year ago

The camera reference has been removed and the SetTrajectoryModule should now properly update the TrajectoryModule shown in the inspector at runtime.