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

Bug 'Rigidbody' does not contain a definition for 'GetAccumulatedForce'

Discussion in 'Scripting' started by MarshCZA, Jul 25, 2022.

  1. MarshCZA

    MarshCZA

    Joined:
    Apr 5, 2016
    Posts:
    6
    I'm trying to use the method implemented in the Rigidbody class: https://docs.unity3d.com/2022.2/Documentation/ScriptReference/Rigidbody.GetAccumulatedForce.html

    Even the most simple use case:


    Rigidbody rb = GetComponent<Rigidbody>();
    rb.GetAccumulatedForce();


    I get an error in visual studio and an error in the console in the editor saying 'Rigidbody' does not contain a definition for 'GetAccumulatedForce'. The function would be really useful for me and save a lot of headaches. Is this something that has the wrong access modifier perhaps?
     
  2. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201
    Looks like it's new, as of 2022.2, so you need to be on the latest version.
     
    MarshCZA likes this.
  3. MarshCZA

    MarshCZA

    Joined:
    Apr 5, 2016
    Posts:
    6
    I assumed the documentation would relate to the latest release, not an alpha release. Thanks for the help!
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,529
    The documentation doesn't take you to alpha/beta release by default, you have to select that yourself. Right now it takes you to 2021.3.

    The link you have does itself show you the version and it states it at the top left of the page too. You can also select the specific version you want to view.
     
  5. RadRedPanda

    RadRedPanda

    Joined:
    May 9, 2018
    Posts:
    1,593
    I will admit, sometimes when I'm searching for certain methods, Google takes me to the page for a different version than the default. Not really Unity's fault, but it's something that can easily happen.
     
    Bunny83 and MelvMay like this.