Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

ArgumentException: The component has not been added to the entity. ???

Discussion in 'Entity Component System' started by Arowx, Jun 14, 2018.

  1. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    ArgumentException: The component has not been added to the entity.

    Getting this error but I have no information on what or where the actual problem is???
     
    keroles-M likes this.
  2. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,554
    I have had a ton of these. And in the Console in a box that changes when you click on the line if you scroll down you can see the problematic lines.

    It will be harder if it is "EntityCommandBuffer" as then the possible source of this is all possible command queuing in your project. But this is a possible message if you use Set/RemoveComponent while the entity does not have that component. (Maybe it was having the component, but by the time ECB play back command it is not anymore)
     
  3. S_P

    S_P

    Joined:
    Sep 20, 2014
    Posts:
    55
    In my case, I had to have a CS file named as the Component Name. For example, if your IConponentData is MoveSpeed struct and Component is MoveSpeedComponent class then you must put them in a CS name MoveSpeedComponent.cs. Else Component System will not recognise it to add to the instantiated object.
     
  4. goodnewsjimdotcom

    goodnewsjimdotcom

    Joined:
    May 24, 2017
    Posts:
    342
    Thank you, I am using EntityCommandBuffer and thank you, I can probably guess the offending lines. This is ruley.