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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Unity Error when building game

Discussion in 'Scripting' started by Redsto, Nov 24, 2017.

  1. Redsto

    Redsto

    Joined:
    Nov 5, 2016
    Posts:
    3
    Whenever I try to build my game I get error codes:
    Assets/HolyShift/Scripts/CheckForStandardAssets.cs(4,7): error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing an assembly reference?

    Assets/Standard Assets/Utility/SimpleActivatorMenu.cs(10,16): warning CS0618: `UnityEngine.GUIText' is obsolete: `This component is part of the legacy UI system and will be removed in a future release.'

    Assets/Standard Assets/Utility/ForcedReset.cs(6,27): warning CS0618: `UnityEngine.GUITexture' is obsolete: `This component is part of the legacy UI system and will be removed in a future release.'

    Error building Player because scripts had compiler errors

    Build completed with a result of 'Failed'
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
    at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x00207] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:172
    at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all
    UnityEngine.MonoBehaviour:.ctor()
    UnityStandardAssets.Utility.PlatformSpecificContent:.ctor() (at Assets/Standard Assets/Utility/PlatformSpecificContent.cs:29)
    UnityEditor.EditorUserBuildSettings:set_selectedStandaloneTarget(BuildTarget)
    DesktopStandaloneBuildWindowExtension:ShowPlatformBuildOptions() (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/DesktopStandaloneBuildWindow.cs:155)
    UnityEditor.PopupCallbackInfo:SetEnumValueDelegate(Object, String[], Int32)

    NullReferenceException
    UnityStandardAssets.CrossPlatformInput.MobileControlRig.EnableControlRig (Boolean enabled) (at Assets/Standard Assets/CrossPlatformInput/Scripts/MobileControlRig.cs:89)
    UnityStandardAssets.CrossPlatformInput.MobileControlRig.CheckEnableControlRig () (at Assets/Standard Assets/CrossPlatformInput/Scripts/MobileControlRig.cs:82)
    UnityStandardAssets.CrossPlatformInput.MobileControlRig.OnActiveBuildTargetChanged (BuildTarget previousTarget, BuildTarget newTarget) (at Assets/Standard Assets/CrossPlatformInput/Scripts/MobileControlRig.cs:98)
    UnityEditor.Build.BuildPipelineInterfaces.OnActiveBuildTargetChanged (BuildTarget previousPlatform, BuildTarget newPlatform) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:345)
    UnityEditor.EditorUserBuildSettings:set_selectedStandaloneTarget(BuildTarget)
    DesktopStandaloneBuildWindowExtension:ShowPlatformBuildOptions() (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/DesktopStandaloneBuildWindow.cs:155)
    UnityEditor.PopupCallbackInfo:SetEnumValueDelegate(Object, String[], Int32)

    Assertion failed: Assertion failed on expression: 'm_CurrentEntriesPtr != NULL && m_IsGettingEntries'
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    Please help I could also collab so you can see for yourself.
     
  2. fire7side

    fire7side

    Joined:
    Oct 15, 2012
    Posts:
    1,819
    You need to import the standard assets package.
     
  3. Redsto

    Redsto

    Joined:
    Nov 5, 2016
    Posts:
    3
    Ok let me try
     
  4. Redsto

    Redsto

    Joined:
    Nov 5, 2016
    Posts:
    3
    It's already imported :(
     
  5. Juan_Luis

    Juan_Luis

    Joined:
    May 10, 2016
    Posts:
    5
    The type or namespace name `UnityEditor' could not be found. Are you missing an assembly reference?

    in the script with this error:
    #if UNITY_EDITOR
    using UnityEditor;
    #endif


    with NullReferenceException
    UnityStandardAssets.CrossPlatformInput.MobileControlRig.EnableControlRig

    the script has error in the namespace,

    must be namespace Standard_Assets.CrossPlatformInput.Scripts

    Other erros I don't know becouse i haven't it :)

    (sorry my english xD)
     
    knockoutdaranarslan likes this.