[HACK/Solved] Entities Preview-8 : InputSystem:data Length must use the "readonly" keyword

I have been having horrible luck with EQS
This is the latest one

ArgumentException: InputSystem:data Length must use the “readonly” keyword
Unity.Entities.InjectComponentGroupData.CreateInjection (System.Type injectedGroupType, System.Reflection.FieldInfo groupField, Unity.Entities.ComponentSystemBase system) (at C:/Users/Mephisto’s Place/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.entities@0.0.12-preview.8/Unity.Entities/Injection/InjectComponentGroup.cs:148)
Unity.Entities.ComponentSystemInjection.Inject (Unity.Entities.ComponentSystemBase componentSystem, Unity.Entities.World world, Unity.Entities.EntityManager entityManager, Unity.Entities.InjectComponentGroupData[ ]& outInjectGroups, Unity.Entities.InjectFromEntityData& outInjectFromEntityData) (at C:/Users/Mephisto’s Place/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.entities@0.0.12-preview.8/Unity.Entities/Injection/ComponentSystemInjection.cs:45)
Unity.Entities.ComponentSystemBase.OnBeforeCreateManagerInternal (Unity.Entities.World world, System.Int32 capacity) (at C:/Users/Mephisto’s Place/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.entities@0.0.12-preview.8/Unity.Entities/ComponentSystem.cs:78)
Unity.Entities.ComponentSystem.OnBeforeCreateManagerInternal (Unity.Entities.World world, System.Int32 capacity) (at C:/Users/Mephisto’s Place/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.entities@0.0.12-preview.8/Unity.Entities/ComponentSystem.cs:310)
Unity.Entities.ScriptBehaviourManager.CreateInstance (Unity.Entities.World world, System.Int32 capacity) (at C:/Users/Mephisto’s Place/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.entities@0.0.12-preview.8/Unity.Entities/ScriptBehaviourManager.cs:21)
Unity.Entities.World.CreateManagerInternal (System.Type type, System.Int32 capacity, System.Object[ ] constructorArguments) (at C:/Users/Mephisto’s Place/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.entities@0.0.12-preview.8/Unity.Entities/Injection/World.cs:162)
Unity.Entities.World.GetOrCreateManagerInternal (System.Type type) (at C:/Users/Mephisto’s Place/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.entities@0.0.12-preview.8/Unity.Entities/Injection/World.cs:190)
Unity.Entities.World.GetOrCreateManager (System.Type type) (at C:/Users/Mephisto’s Place/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.entities@0.0.12-preview.8/Unity.Entities/Injection/World.cs:243)
Unity.Entities.DefaultWorldInitialization.GetBehaviourManagerAndLogException (Unity.Entities.World world, System.Type type) (at C:/Users/Mephisto’s Place/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.entities@0.0.12-preview.8/Unity.Entities.Hybrid/Injection/DefaultWorldInitialization.cs:21)
UnityEngine.Debug:LogException(Exception)
Unity.Debug:LogException(Exception) (at C:/Users/Mephisto’s Place/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.entities@0.0.12-preview.8/Unity.Entities/Stubs/Unity/Debug.cs:25)
Unity.Entities.DefaultWorldInitialization:GetBehaviourManagerAndLogException(World, Type) (at C:/Users/Mephisto’s Place/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.entities@0.0.12-preview.8/Unity.Entities.Hybrid/Injection/DefaultWorldInitialization.cs:25)
Unity.Entities.DefaultWorldInitialization:CreateBehaviourManagersForMatchingTypes(Boolean, IEnumerable`1, World) (at C:/Users/Mephisto’s Place/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.entities@0.0.12-preview.8/Unity.Entities.Hybrid/Injection/DefaultWorldInitialization.cs:91)
Unity.Entities.DefaultWorldInitialization:Initialize(String, Boolean) (at C:/Users/Mephisto’s Place/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.entities@0.0.12-preview.8/Unity.Entities.Hybrid/Injection/DefaultWorldInitialization.cs:57)
Unity.Entities.AutomaticWorldBootstrap:Initialize() (at C:/Users/Mephisto’s Place/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.entities@0.0.12-preview.8/Unity.Entities.Hybrid/Injection/AutomaticWorldBootstrap.cs:11)

The only place I make reference to Input is here

public class InputSystem : ComponentSystem
{
    struct Data
    {
        public int Length;
        public ComponentArray<InputComponent> InputComponents;
    }

    [Inject]
    Data data;

    protected override void OnUpdate()
    {
        //Optimization. Cache the result outside the loop
        var h = Input.GetAxis("Horizontal");
        var v = Input.GetAxis("Vertical");

        for (int i =0; i < data.Length; ++i)
        {
            data.InputComponents[i].horizontal = h;
            data.InputComponents[i].vertical = v;
        }
    }
}

Code works fine in Preview-6

Time between hitting the play button and actually playing is also noticeable
and every play begins with this error

System.ComponentModel.Win32Exception (0x80004005): ApplicationName=‘“C:\Users\Mephisto’s Place\AppData\Local\Unity\cache\packages\packages.unity.com\com.unity.incrementalcompiler@0.0.42-preview.12.bin\csc.exe”’, CommandLine=‘–server --watchdog=12124 --port=5047 --workingDirectory=“E:\Unity Projects\ECS-AI”’, CurrentDirectory=‘E:\Unity Projects\ECS-AI’, Native error= The system cannot find the file specified.

at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x002dc] in <343bdfbb3c2d4d21b745a87548c1a7cd>:0
at System.Diagnostics.Process.Start () [0x0003a] in <343bdfbb3c2d4d21b745a87548c1a7cd>:0
at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
at UnityEditor.Compilation.CompilerConnection.StartIncrementalCompilerProcess () [0x0009a] in <7f5896f986c54cae8a8ba335f1aca335>:0
at UnityEditor.Compilation.CompilerConnection.InitializeSingleton () [0x00041] in <7f5896f986c54cae8a8ba335f1aca335>:0
at UnityEditor.Compilation.RoslynCompilerBootstrap…cctor () [0x0000a] in <7f5896f986c54cae8a8ba335f1aca335>:0
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes()

I can diagnose your first issue, at least.

They changed the injection setup in newer releases so that the length field is now required to be marked as readonly

struct Data
{
    //...
    public readonly int Length; // must now be marked as readonly if present
    public readonly int GroupIndex; // optional, can use it to define the component group via injection, but still use the filtering options via the ComponentGroups indexer now accessible in JobComponentSystem and ComponentSystem, I don't recall exactly which preview it was added in, but I have the latest working.
}

See if that helps on preview-8

1 Like

To get any package working i have to delete the library folder each time

If not i get these

HAHAHAHAHAHA
I cheated the system. I just dumped all the files I needed into the asset folder and it worked
Down with the package manager

This is the only Error you get and it doesn’t seem to matter

1 Like