jm991 / UnityThirdPersonTutorial

Sample project showing third person camera behavior and Mecanim animations
252 stars 189 forks source link

Answered: Error with scripts when building Player #4

Open theviolinmasta opened 9 years ago

theviolinmasta commented 9 years ago

How do I fix this?

Assets/Scripts/ThirdPersonCamera.cs(24,7): error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing a using directive or an assembly reference?

and

Assets/Scripts/ThirdPersonCameraEditor.cs(3,7): error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing a using directive or an assembly reference?

Error building Player because scripts had compiler errors

zr3 commented 9 years ago

The UnityEditor namespace isn't included in builds, which is causing the problem. You can move "ThirdPersonCameraEditor.cs" to a new folder called "Editor" (Unity arbitrarily excludes this folder from builds), and wrap the editor debug code in ThirdPersonCamera.cs in "#if UNITY_EDITOR" and "#endif" preprocessor statements to exclude them from builds. Specifically, at the beginning of ThirdPersonCamera.cs:

using UnityEngine;
using System.Collections;

#if UNITY_EDITOR
using UnityEditor;
#endif

and in the "Unity event functions" region:

#if UNITY_EDITOR
/// <summary>
/// Debugging information should be put here.
/// </summary>
void OnDrawGizmos ()
{   
    if (EditorApplication.isPlaying && !EditorApplication.isPaused)
    {           
        DebugDraw.DrawDebugFrustum(viewFrustum);
    }
}
#endif

Hope that helps you out!

theviolinmasta commented 9 years ago

Thank you! Working great now!

Species-8472 commented 7 years ago

I've tryed all this and it does not work for me... :( pls help

OkashiKami commented 7 years ago

changed the character mat and will be adding more ui and weapons to character that you will be able to switch out. COMMING SOON!!!