Some bugs and performance issues I noticed while playing around with the new version of AO.
Player builds are failing due to references to UnityEditor in non-editor scripts.
Assets\AO\Scripts\Flow\FluidVolume.cs(446,13): error CS0234: The type or namespace name 'EditorApplication' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)
Assets\AO\Scripts\Flow\FluidVolume.cs(32,30): warning CS0109: The member 'FluidVolume.collider' does not hide an accessible member. The new keyword is not required.
Assets\AO\Scripts\Flow\VortexNode.cs(32,21): error CS0234: The type or namespace name 'EditorApplication' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)
Assets\AO\Scripts\Flow\VortexNode.cs(48,62): error CS0103: The name 'HandleUtility' does not exist in the current context
Assets\AO\Scripts\Flow\UniformFlow.cs(97,40): error CS0103: The name 'HandleUtility' does not exist in the current context
Assets\AO\Scripts\Flow\UniformFlow.cs(99,13): error CS0103: The name 'Handles' does not exist in the current context
Assets\AO\Scripts\Flow\UniformFlow.cs(100,13): error CS0103: The name 'Handles' does not exist in the current context
Assets\AO\Scripts\Flow\AreaSource.cs(108,13): error CS0103: The name 'Handles' does not exist in the current context
Assets\AO\Scripts\Flow\AreaSource.cs(113,21): error CS0103: The name 'Handles' does not exist in the current context
Assets\AO\Scripts\Flow\AreaSource.cs(117,21): error CS0103: The name 'Handles' does not exist in the current context
These can be fixed by adding #if UNITY_EDITOR blocks around the references to UnityEditor things.
2. The localFluidVolumes.RemoveAll call in FlowAffected.cs is allocating a lot of memory every frame. This can be fixed by using a for loop instead.
for (int i = localFluidVolumes.Count -1; i >= 0; i--)
{
FluidVolume item = localFluidVolumes[i];
if (item == null || FlowInteractionManager.IsInteractionIgnored(interactionID, item.interactionID))
{
localFluidVolumes.RemoveAt(i);
}
}
3. When using LiftingBodyWake, it is constantly Instantiating and Destroying GameObjects every frame. It would be much more efficient to use ObjectPooling for this or use data structures outside of GameObjects entirely.