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 March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Question optimization of the bezier formula for list

Discussion in 'Scripting' started by Slabada, Jan 8, 2023.

  1. Slabada

    Slabada

    Joined:
    May 2, 2021
    Posts:
    50
    Hello, I want to make a trajectory using points and the Bezier curve formula.
    I was able to figure out how to do for a static number and points, but I can't figure out how to optimize the formula for a list so that N number of points appear on the scene while the code is running and only then the curve is built.
    Is it even possible to do this ? :/
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    32,305
    Collections such as Lists and Arrays have properties to indicate their size.

    List<T>() reports size via the .Count property

    Arrays report size via the .Length property

    Go check out some tutorials on C# collections, or simply review the API docs.