Search Unity

PrefabUtility.GetCorrespondingObjectFromSource not working

Discussion in 'Scripting' started by Kori_Green, Sep 20, 2018.

  1. Kori_Green

    Kori_Green

    Joined:
    Aug 2, 2018
    Posts:
    5
    Hi. I recently copied the contents of NavMeshSurface and related scripts as instructed on Github. One of the lines in the scripts uses PrefabUtility.GetCorrespondingObjectFrom Source. I've checked the unity manual and this seems to be a standard feature of Unity Editor, but I keep getting this message on Unity after compiling: 'UnityEditor.PrefabUtility' does not contain a definition for 'GetCorrespondingObjectFromSource'. I'm not sure what to do about this
     
  2. Zante

    Zante

    Joined:
    Mar 29, 2008
    Posts:
    429
    SOLVED:
    Make sure you download the correct branch version via the following page:
    https://github.com/Unity-Technologies/NavMeshComponents/branches

    ===============================================

    Original Issue:

    Also getting this error, which comes as part of a tutorial sponsored by Unity themselves.

    Via the following link:

    I've commented on the video regarding this problem.

    The console output is as follows (Unity 2017.4.2f2):
    Code (CSharp):
    1. `Assets/NavMeshComponents/Scripts/NavMeshSurface.cs(376,52): error CS0117: `UnityEditor.PrefabUtility' does not contain a definition for `GetCorrespondingObjectFromSource''

    The GitHub repository in question can be found at the following location:
    https://github.com/Brackeys/NavMesh-Tutorial
     
    Last edited: Oct 28, 2018
    nirvanajie likes this.
  3. manirana94

    manirana94

    Joined:
    Apr 16, 2018
    Posts:
    7
    • Changed reference to PrefabUtility.GetPrefabParent() to PrefabUtility.GetCorrespondingObjectFromSource() to reflect public API change in 2018.2
    Unity provides automatic API update for upgrading but not downgrading.

    Change GetCorrespondingObjectFromSource to GetPrefabParent by yourself.