Search code examples
unity-game-engineerror-handlingtexturestexture2d

Error after importing UFPS latest in Unity


I just downloaded UFPS asset in unity but after importing i get some errors. I cant find a way online on how to fix that.

Unity Version: 2018

Errors:

Assets/UFPS/Base/Scripts/Gameplay/Player/Local/vp_LocalPlayer.cs(62,46): error CS1540: Cannot access protected member UnityEngine.Texture.Texture()' via a qualifier of typeUnityEngine.Texture'. The qualifier must be of type `vp_LocalPlayer' or derived from it

:

Assets/UFPS/Base/Scripts/Gameplay/Player/Local/vp_LocalPlayer.cs(62,46): error CS0122: `UnityEngine.Texture.Texture()' is inaccessible due to its protection level

Line with error:

static Texture m_InvisibleTexture = new Texture();

Solution

  • Replace your line with

    private static Texture m_InvisibleTexture = new Texture2D(2, 2);
    

    You'll also run into this error:

    Assets/UFPS/Base/Scripts/Gameplay/Editor/vp_FootstepManagerEditor.cs(228,25): error CS0143: The class `UnityEngine.AudioClip' has no constructors defined

    Here's a link to a fix and more about the problems you'll encounter:

    http://www.opsive.com/assets/UFPS/forum/index.php?p=/discussion/3979/2018-compatibility