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. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

HasComponent & GetComponentData problem

Discussion in 'Project Tiny' started by Seaqqull, Dec 10, 2020.

  1. Seaqqull

    Seaqqull

    Joined:
    Aug 3, 2018
    Posts:
    23
    Hello, I have an issue with getting new created and attached components to the [Entity].
    For example, I have an [Entity] - [Person], and it has several custom components: AttackAction, DieAction, TakingDamageAction, etc.
    But when I create a new component [WinAction], attach it to the same [Entity], and trying to get that component data (using [HasComponent] & [GetComponentData]) it shows me that there is actually no such component attached to the [Entity].
    *This [Entity] is never disabled and enabled.
     
  2. Sarkahn

    Sarkahn

    Joined:
    Jan 9, 2013
    Posts:
    440
    Can you show the actual code where the problem is happening and the error you're getting?
     
  3. Seaqqull

    Seaqqull

    Joined:
    Aug 3, 2018
    Posts:
    23
    In this code, inside of Stage = Win. I know that for sure that the entity has [WinActionComponent]. But it works as it hasn't
     

    Attached Files:

    • 1.png
      1.png
      File size:
      24.6 KB
      Views:
      274