Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Accessing Objects from Systems

Discussion in 'Scripting' started by Blargenflargle, May 8, 2020.

  1. Blargenflargle

    Blargenflargle

    Joined:
    Feb 24, 2019
    Posts:
    92
    Hello, I was wondering if there was any overhead when accessing an object from a System in ECS. For instance, say I want to make a subsystem for dialogue that an ECS system can access, but I don't want to use components for it. Besides (obviously) the overhead baked into running the functions associated with that object, would you significantly slow down your ECS code? To clarify, I'm not talking about using monobehaviours per se, but just generic classes/objects. Thanks!
     
  2. Blargenflargle

    Blargenflargle

    Joined:
    Feb 24, 2019
    Posts:
    92
    So the short answer is... sort of. You should be able to get away with accessing an object, or storing an instance of an object in a system and working with that, but you shouldn't instantiate objects inside the loop of a system. That will cause big slow downs. At least that's my understanding of things.