Generate RANDOM VALUES in ECS - Unity DOTS Tutorial [ECS Ver. 0.17]

แชร์
ฝัง
  • เผยแพร่เมื่อ 31 ธ.ค. 2024

ความคิดเห็น • 29

  • @TurboMakesGames
    @TurboMakesGames  2 ปีที่แล้ว +1

    ❗❗ *Caution:* This video was made using an older version of Unity ECS. While the core concepts remain the same, some of the API and workflows have changed as of ECS version 1.0. I would recommend checking out my ECS 1.0 tutorial video for a good overview of the latest standards for Unity’s DOTS: th-cam.com/video/IO6_6Y_YUdE/w-d-xo.html
    Once again, the theory behind the concepts of this video are still relevant, however the API has changed. Stay tuned for further updated videos on this subject. Please let me know if you have any questions either here or in our Discord community: tmg.dev/Discord

  • @xanderlinhares
    @xanderlinhares 3 ปีที่แล้ว +4

    Thanks for all the ECS content!

  • @pedrodesanti6266
    @pedrodesanti6266 3 ปีที่แล้ว +1

    your channel deserves a lot more recognition

  • @Aedeus
    @Aedeus 3 ปีที่แล้ว +1

    These tutorials are getting better and better.

    • @TurboMakesGames
      @TurboMakesGames  3 ปีที่แล้ว

      Awesome thanks for the positive feedback!

  • @cgh353
    @cgh353 2 ปีที่แล้ว +1

    I Appreciate it. Im just getting into entities0.50. there is not much from others. THanks

    • @TurboMakesGames
      @TurboMakesGames  2 ปีที่แล้ว

      Awesome, 0.50 is a great version to get into! Hope all's been going well for you

  • @mikesteam831
    @mikesteam831 3 ปีที่แล้ว +2

    I think Meckara is wrong.
    WE are getting better and better with these tutorials. :-)
    Thanks Johnny!

    • @TurboMakesGames
      @TurboMakesGames  3 ปีที่แล้ว +1

      🙌🙌🙌
      That's what I like to hear!

    • @Songfugel
      @Songfugel 2 ปีที่แล้ว

      Agree, after a little over years hiatus binging over Turbo's ECS content, and the video quality has shot up significantly in clarity and conciseness

  • @myelinsheathxd
    @myelinsheathxd 3 ปีที่แล้ว +1

    Thx! amazing arrow method => !!!
    physics related tutorials would be cool as well!

    • @TurboMakesGames
      @TurboMakesGames  3 ปีที่แล้ว

      The expression bodied syntax is great!! Thanks for the suggestion, noted!

  • @logicprojects
    @logicprojects 3 ปีที่แล้ว +1

    Great content!

  • @carl-johanhorberg1399
    @carl-johanhorberg1399 3 ปีที่แล้ว +4

    A little heads up,
    Remember to state the IndividualRandomData as a "ref" and not as "in", when calling the "NextFloat", or you will keep getting the same sandom number every time. I suppose that this has to do with the "NextFloat"-function, and that it needs permission to write back to the state value of the random state in the component.
    Thanks for a great tutorial!

    • @TurboMakesGames
      @TurboMakesGames  3 ปีที่แล้ว

      Yes definitely! I could have sworn I mentioned that at some point in the video - but yes your assumption is correct basically each new random state depends on the previous random state. Glad you found the video helpful!

    • @carl-johanhorberg1399
      @carl-johanhorberg1399 3 ปีที่แล้ว

      @@TurboMakesGames You probably did! I tend to scroll though to find the part I'm looking for. By the way, I'm incredibly grateful that you make these videos, it's been and incredible resource for learning ECS. Keep it up man!

  • @a.technology1446
    @a.technology1446 3 ปีที่แล้ว +1

    Thanks for your efforts

  • @harishg9
    @harishg9 2 ปีที่แล้ว

    Hi,
    I have been following your tutorials on ECS especially. When trying to implement the same, I am getting an exception.
    InvalidOperationException: The previously scheduled job GenericMovementSystem:OnUpdate_LambdaJob0 reads from the ComponentTypeHandle
    Any idea what could have gone wrong?

    • @TurboMakesGames
      @TurboMakesGames  2 ปีที่แล้ว

      That's potentially a job dependency issue. What does the full text of the error say? Are you using an Entity Command Buffer?

    • @MrMorvar
      @MrMorvar 2 ปีที่แล้ว

      I had a similar "job" related error when initializing the random in OnCreate()
      As a workaround to skip whole OnCreate part, this worked:
      1. Add a boolean variable to IndividualRandomData script called "randomInitialized" with false value
      2. In the OnUpdate part of IndividualRandomSystem script check if the random has been initialized and only do it once:
      Entities.ForEach ((Entity e, int entityInQueryIndex, ref Translation translation, ref IndividualRandomData randomData) =>
      {
      if (!randomData.randomInitialized)
      {
      randomData.randomInitialized = true;
      randomData.value = Unity.Mathematics.Random.CreateFromIndex ((uint) entityInQueryIndex);
      }
      translation.Value.x = randomData.value.NextFloat (0, 3f);
      }).ScheduleParallel ();

  • @janitor13
    @janitor13 ปีที่แล้ว +1

    How in DOTS 1.0 made random values for individual entites?

    • @TurboMakesGames
      @TurboMakesGames  ปีที่แล้ว

      If you need unique random values for each entity, the best option usually is to have a random component on each entity, the key is to be sure to initialize it to a unique value for each entity so each one generates different random numbers. Hope that helps!

    • @janitor13
      @janitor13 ปีที่แล้ว

      @@TurboMakesGames I did that, but I passed different seed values ​​to the baker, but it didn’t work, everyone always had the same value) After that, I already realized that the baker bakes values ​​for the prefab and not for entities, and then when creating entities and in the spawn system, I gave them a random seed value and updated the component. And it's worked!

  • @karmo0o178
    @karmo0o178 2 ปีที่แล้ว

    So i just cant figure out how this works, is it bad if i just use regular Random.Range and Random.seed.

    • @TurboMakesGames
      @TurboMakesGames  2 ปีที่แล้ว

      It's not "bad" you just won't be able to take advantage of the main benefits of ECS like parallel processing - if that's not something that your random relies on then that's no problem really.