Problem: Visual Graphs get corrupted during playmode, and are unusable thereafter
Visual Scripting Version: Public preview drop 1
Unity Version: 2019.2.a14
OS: Windows 10
What I did
1) Downloaded Drop #1, and the samples
2) Created a new scene, added a cube, then tagged the cube with an empty ComponentaData (same as CounterComponent but empty) script, and added Conver to Entity script
using System;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using UnityEngine;
[RequiresEntityConversion]
[DisallowMultipleComponent]
public class ShipComponent : MonoBehaviour, IConvertGameObjectToEntity {
public Ship data;
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
dstManager.AddComponentData(entity, data);
}
}
[Serializable]
public struct Ship : IComponentData {}
Here's what the inspector looks like on my cube game object named "Ship":
3) Added a visual effect graph to rotate, and translate the cube based on user input. Here is the graph (Note i recreated it after it was corrupted)
The code generated is this:
using System;
using Unity.Burst;
using Unity.Entities;
using Unity.Jobs;
using Unity.Mathematics;
using Unity.Transforms;
using Unity.Collections;
using Microsoft.CSharp;
using UnityEngine;
public class ShipMovement : JobComponentSystem
{
private Unity.Entities.EntityQuery Ship_Query;
protected override void OnCreateManager()
{
Ship_Query = GetEntityQuery(ComponentType.ReadWrite<Unity.Transforms.Rotation>(), ComponentType.ReadWrite<Unity.Transforms.Translation>(), ComponentType.ReadOnly<Unity.Transforms.LocalToWorld>(), ComponentType.ReadOnly<Ship>(), ComponentType.ReadOnly<Unity.Rendering.PerInstanceCullingTag>(), ComponentType.ReadOnly<Unity.Rendering.RenderMesh>());
}
protected override JobHandle OnUpdate(JobHandle inputDeps)
{
inputDeps.Complete();
{
var Ship_QueryEntities = Ship_Query.ToEntityArray(Allocator.TempJob);
var Ship_QueryRotationArray = Ship_Query.ToComponentDataArray<Unity.Transforms.Rotation>(Allocator.TempJob);
var Ship_QueryTranslationArray = Ship_Query.ToComponentDataArray<Unity.Transforms.Translation>(Allocator.TempJob);
for (int Ship_QueryIdx = 0; Ship_QueryIdx < Ship_QueryEntities.Length; Ship_QueryIdx++)
{
var Ship_QueryEntity = Ship_QueryEntities[Ship_QueryIdx];
var Ship_QueryRotation = Ship_QueryRotationArray[Ship_QueryIdx];
var Ship_QueryTranslation = Ship_QueryTranslationArray[Ship_QueryIdx];
Ship_QueryTranslation.Value.x += (UnityEngine.Input.GetAxis("Horizontal") / 15F);
Ship_QueryTranslation.Value.y += (UnityEngine.Input.GetAxis("Vertical") / 8F);
Ship_QueryTranslation.Value.z += 0F;
Ship_QueryRotation.Value = math.mul(Ship_QueryRotation.Value, quaternion.EulerXYZ(0F, ((UnityEngine.Input.GetAxis("Horizontal") / 15F) / 15F), 0F));
EntityManager.SetComponentData<Unity.Transforms.Rotation>(Ship_QueryEntities[Ship_QueryIdx], Ship_QueryRotation);
EntityManager.SetComponentData<Unity.Transforms.Translation>(Ship_QueryEntities[Ship_QueryIdx], Ship_QueryTranslation);
}
Ship_QueryRotationArray.Dispose();
Ship_QueryTranslationArray.Dispose();
Ship_QueryEntities.Dispose();
}
return inputDeps;
}
}
4) Press play, nothing moves, and visual effect graph is super corrupt, as seen below:
5) Press play again, it looks great, smooth movement. Still errors. Cube moves around fine.
6) End play mode, and look at the visual effect graph, it's now like this (The generated code is still fine):
7) Errors (During Playmode):
a. could not create UI for element UnityEditor.VisualScripting.Editor.FunctionNode:.ctor(Store, IFunctionModel, INodeBuilder) Packages.VisualScripting.Editor.Stencils.IteratorStackNode:.ctor(Store, IIteratorStackModel, INodeBuilder) (at Packages/com.unity.visualscripting.entities/Editor/Stencils/IteratorStackNode.cs:12) Packages.VisualScripting.Editor.Stencils.EcsGraphElementFactoryExtensions:CreateOrderedStack(INodeBuilder, Store, IOrderedStack) (at Packages/com.unity.visualscripting.entities/Editor/Stencils/EcsGraphElementFactoryExtensions.cs:14) UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
and
AssertionException: Assertion failure. Value was Null Expected: Value was not Null Edge 5 input is null, output: Port Divide (UnityEditor.VisualScripting.Model.BinaryOperatorNodeModel)@0: Data Out UnityEngine.Assertions.Assert.Fail (System.String message, System.String userMessage) (at C:/buildslave/unity/build/Runtime/Export/Assertions/Assert/AssertBase.cs:29) UnityEngine.Assertions.Assert.IsNotNull[T] (T value, System.String message) (at C:/buildslave/unity/build/Runtime/Export/Assertions/Assert/AssertNull.cs:50) UnityEditor.VisualScripting.Model.VSGraphModel.CheckIntegrity (UnityEditor.VisualScripting.GraphViewModel.GraphModel+Verbosity errors) (at Packages/com.unity.visualscripting/Editor/VisualScripting/Model/VSGraph/VSGraphModel.cs:172) UnityEditor.VisualScripting.Editor.VseWindow.StoreOnStateChanged () (at Packages/com.unity.visualscripting/Editor/VisualScripting/Editor/VseWindow.cs:588) UnityEditor.EditorCommon.Redux.Store1[TState].InvokeStateChanged () (at Packages/com.unity.visualscripting/Editor/EditorCommon/Redux/Store.cs:191) UnityEditor.EditorCommon.Redux.Store1[TState].Update () (at Packages/com.unity.visualscripting/Editor/EditorCommon/Redux/Store.cs:176) UnityEditor.VisualScripting.Editor.VseWindow.Update () (at Packages/com.unity.visualscripting/Editor/VisualScripting/Editor/VseWindow.cs:736) System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <23c160f925be47d7a4fd083a3a62c920>:0) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <23c160f925be47d7a4fd083a3a62c920>:0) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <23c160f925be47d7a4fd083a3a62c920>:0) UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:348) UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:342) UnityEditor.HostView.SendUpdate () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:454) UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:303)
8) Warnings during playmode:
Edge 5 cannot be restored: @1 -> Divide (UnityEditor.VisualScripting.Model.BinaryOperatorNodeModel)@0 UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
Edge 6 cannot be restored: @2 -> Divide (UnityEditor.VisualScripting.Model.BinaryOperatorNodeModel)@0 UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
To Debug, enable the define: TLA_DEBUG_STACK_LEAK in ThreadsafeLinearAllocator.cpp. This will output the callstacks of the leaked allocations
Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak
Problem: Visual Graphs get corrupted during playmode, and are unusable thereafter Visual Scripting Version: Public preview drop 1 Unity Version: 2019.2.a14 OS: Windows 10
What I did 1) Downloaded Drop #1, and the samples 2) Created a new scene, added a cube, then tagged the cube with an empty ComponentaData (same as CounterComponent but empty) script, and added Conver to Entity script
Here's what the inspector looks like on my cube game object named "Ship":
3) Added a visual effect graph to rotate, and translate the cube based on user input. Here is the graph (Note i recreated it after it was corrupted)
The code generated is this:
4) Press play, nothing moves, and visual effect graph is super corrupt, as seen below: 5) Press play again, it looks great, smooth movement. Still errors. Cube moves around fine. 6) End play mode, and look at the visual effect graph, it's now like this (The generated code is still fine):
7) Errors (During Playmode):
and
8) Warnings during playmode:
I probably missed something, let me know.