How to fix SmoothFollow compiler error

Hi, I am getting this error which began when I installed an asset store script.

Assets\OWCS\Scripts\SequenceManager.cs(188,16): error CS0246: The type or namespace name ‘SmoothFollow’ could not be found (are you missing a using directive or an assembly reference?)

The file causing the issues is below:

using UnityEngine;
using System.Collections;
using UnityEngine.Rendering.PostProcessing;

namespace OWCS
{
    public class SequenceManager : MonoBehaviour
    {

        public CharacterTransition CharSwitch;

        public static SequenceManager Instance;

        DepthOfField depth;

        void Awake()
        {
            Instance = this;
            depth = Camera.main.GetComponent<DepthOfField>();
        }

        public IEnumerator DoCharSwitch(Character c)
        {
            int i = 0;

            Transform t = CharSwitch.Follower.transform;

            while(i < 3 )
            {
                if (i == 0)
                {
                    depth.enabled = true;
                    CharSwitch.Follower.height = CharSwitch.Height;


                    while (Mathf.Round(CharSwitch.Follower.transform.position.y) != CharSwitch.Height)
                    {
                        if (CharSwitch.Follower.transform.position.y == t.position.y)
                        {
                            Vector3 pos = CharSwitch.Follower.transform.position;

                            pos.y = Mathf.Round(CharSwitch.Height / 3);



                            CharSwitch.Follower.transform.position = pos;

                            depth.aperture = 0.8f;

                            yield return new WaitForSeconds(0.75f);
                        }

                        if (CharSwitch.Follower.transform.position.y == Mathf.Round(CharSwitch.Height / 3))
                        {
                            Vector3 pos = CharSwitch.Follower.transform.position;

                            pos.y = pos.y + Mathf.Round(CharSwitch.Height / 3);



                            CharSwitch.Follower.transform.position = pos;

                            depth.aperture = 0.9f;

                            yield return new WaitForSeconds(0.75f);
                        }
                        if (CharSwitch.Follower.transform.position.y == Mathf.Round(CharSwitch.Height / 3 * 2))
                        {
                            Vector3 pos = CharSwitch.Follower.transform.position;

                            pos.y = CharSwitch.Height;



                            CharSwitch.Follower.transform.position = pos;

                            depth.aperture = 1f;

                            yield return new WaitForSeconds(0.75f);
                        }

                       

                        yield return new WaitForEndOfFrame();
                    }
                }
                if (i == 1)
                {
                    Vector3 pos = new Vector3(c.Instance.transform.position.x, CharSwitch.Height, c.Instance.transform.position.z);



                        if (CharSwitch.Follower.transform.position.x < pos.x)
                        {
                            pos.x += 0.35f;
                        }
                        else if (CharSwitch.Follower.transform.position.x > pos.x)
                        {
                            pos.x -= 0.35f;
                        }

                        CharSwitch.Follower.transform.position = pos;

                        yield return new WaitForEndOfFrame();
                   
                }

                if(i == 2)
                {
                    depth.focalTransform = c.Instance.transform;
                    Camera.main.GetComponent<SmoothFollow>().target = c.Instance.transform;
                    CharSwitch.Follower.height = 2;
                    while (Mathf.Round(CharSwitch.Follower.transform.position.y) != 2)
                    {
                        if (CharSwitch.Follower.transform.position.y == CharSwitch.Height)
                        {
                            depth.aperture = 1f;

                            Vector3 pos = CharSwitch.Follower.transform.position;

                            pos.y = Mathf.Round(CharSwitch.Height /3 * 2);



                            CharSwitch.Follower.transform.position = pos;

                            yield return new WaitForSeconds(0.75f);
                        }
                        if (CharSwitch.Follower.transform.position.y == Mathf.Round(CharSwitch.Height / 3 * 2))
                        {
                            depth.aperture = 0.9f;

                            Vector3 pos = CharSwitch.Follower.transform.position;

                            pos.y = Mathf.Round(CharSwitch.Height / 3);



                            CharSwitch.Follower.transform.position = pos;

                            yield return new WaitForSeconds(0.75f);
                        }
                        if (CharSwitch.Follower.transform.position.y == Mathf.Round(CharSwitch.Height / 3))
                        {
                            depth.aperture = 0.8f;

                            Vector3 pos = CharSwitch.Follower.transform.position;

                            pos.y = 2;



                            CharSwitch.Follower.transform.position = pos;

                            yield return new WaitForSeconds(0.75f);
                        }


                        yield return new WaitForEndOfFrame();
                    }
                    GameManager.Instance.CanShowSwitch = true;
                    depth.enabled = false;
                }
                i++;
            }
            StopCoroutine("DoCharSwitch");
            yield return null;
        }

        // Use this for initialization
        void Start()
        {

        }

        // Update is called once per frame
        void Update()
        {

        }
    }

    [System.Serializable]
    public class CharacterTransition
    {
        public float Height;
        public float Speed;
        public SmoothFollow Follower;
    }
}

If I use the hover context actions in VS such as adding: using UnityStandardAssets.Utility; I get 17 plus errors.

Any ideas what is causing this. The SmoothFollow.cs file exists in Standard Assets/Utility folder.

Im not a coder or very limited at best so cant get my way around this issue.

Any help appreciated as I have been on this for 2 days solid, watched just about the entire content of youtube to no avail.

Many thanks in advance.

What are the errors you get if you include UnityStandardAssets.Utility? Are you sure that the SmoothFollow the SequenceManager expects is the same SmoothFollow that is in the Standard Assets?

1 Like

I am actually doing a bake at present so cant check the other errors that occur. There are 17 of them. I will post back here when I can copy them.

Thanks for the response, Ive been searching for a solution for days now so much appreciated.

Hi, thanks again for the response.

If I add: using UnityStandardAssets.Utility;

The errors are as follows:

Assets\OWCS\Scripts\SequenceManager.cs(33,37): error CS0029: Cannot implicitly convert type ‘bool’ to ‘UnityEngine.Rendering.PostProcessing.BoolParameter’

Assets\OWCS\Scripts\SequenceManager.cs(34,41): error CS1061: ‘SmoothFollow’ does not contain a definition for ‘height’ and no accessible extension method ‘height’ accepting a first argument of type ‘SmoothFollow’ could be found (are you missing a using directive or an assembly reference?)

Assets\OWCS\Scripts\SequenceManager.cs(49,46): error CS0029: Cannot implicitly convert type ‘float’ to ‘UnityEngine.Rendering.PostProcessing.FloatParameter’

Assets\OWCS\Scripts\SequenceManager.cs(64,46): error CS0029: Cannot implicitly convert type ‘float’ to ‘UnityEngine.Rendering.PostProcessing.FloatParameter’

Assets\OWCS\Scripts\SequenceManager.cs(78,46): error CS0029: Cannot implicitly convert type ‘float’ to ‘UnityEngine.Rendering.PostProcessing.FloatParameter’

Assets\OWCS\Scripts\SequenceManager.cs(111,27): error CS1061: ‘DepthOfField’ does not contain a definition for ‘focalTransform’ and no accessible extension method ‘focalTransform’ accepting a first argument of type ‘DepthOfField’ could be found (are you missing a using directive or an assembly reference?)

Assets\OWCS\Scripts\SequenceManager.cs(112,62): error CS1061: ‘SmoothFollow’ does not contain a definition for ‘target’ and no accessible extension method ‘target’ accepting a first argument of type ‘SmoothFollow’ could be found (are you missing a using directive or an assembly reference?)

Assets\OWCS\Scripts\SequenceManager.cs(113,41): error CS1061: ‘SmoothFollow’ does not contain a definition for ‘height’ and no accessible extension method ‘height’ accepting a first argument of type ‘SmoothFollow’ could be found (are you missing a using directive or an assembly reference?)

Assets\OWCS\Scripts\SequenceManager.cs(118,46): error CS0029: Cannot implicitly convert type ‘float’ to ‘UnityEngine.Rendering.PostProcessing.FloatParameter’

Assets\OWCS\Scripts\SequenceManager.cs(132,46): error CS0029: Cannot implicitly convert type ‘float’ to ‘UnityEngine.Rendering.PostProcessing.FloatParameter’

Assets\OWCS\Scripts\SequenceManager.cs(146,46): error CS0029: Cannot implicitly convert type ‘float’ to ‘UnityEngine.Rendering.PostProcessing.FloatParameter’

Assets\OWCS\Scripts\SequenceManager.cs(163,37): error CS0029: Cannot implicitly convert type ‘bool’ to ‘UnityEngine.Rendering.PostProcessing.BoolParameter’

Assets\OWCS\Scripts\GameManager.cs(59,61): error CS0246: The type or namespace name ‘ThirdPersonCharacter’ could not be found (are you missing a using directive or an assembly reference?)

Assets\OWCS\Scripts\GameManager.cs(60,65): error CS0246: The type or namespace name ‘ThirdPersonCharacter’ could not be found (are you missing a using directive or an assembly reference?)

Assets\OWCS\Scripts\GameManager.cs(61,38): error CS0246: The type or namespace name ‘SmoothFollow’ could not be found (are you missing a using directive or an assembly reference?)

Assets\OWCS\Scripts\GameManager.cs(71,61): error CS0246: The type or namespace name ‘ThirdPersonCharacter’ could not be found (are you missing a using directive or an assembly reference?)

Assets\OWCS\Scripts\GameManager.cs(72,65): error CS0246: The type or namespace name ‘ThirdPersonCharacter’ could not be found (are you missing a using directive or an assembly reference?)

ADDITION:
If I then remove the: using UnityEngine.Rendering.PostProcessing;

I just get this error:

Assets\OWCS\Scripts\SequenceManager.cs(15,9): error CS0246: The type or namespace name ‘DepthOfField’ could not be found (are you missing a using directive or an assembly reference?)

The asset you are using is not up to date with how the post processing stack works. You have to go through every error and fix it. The errors explain the exact problem.

1 Like