Unity 2020.3.5f1 Not Calling Update

Hello ppl hope you doing well, so I recently got this problem where the editor stopped calling Update function in one particular script of my project. All the major dumb mistakes that may cause this issue are already like “Penta checked” for now, so its enabled, its attached to the object the object is enable, its inheriting from MonoBehaviour and all of thouse stuff are completely correct.

I’ve noticed that when I change the Update() to FixedUpdate() it works, but its bugging me that its happening only in this particular script to Find an Object With Tag.

Also some ppl are having this issue on a very old thred so I reposted it to see I someone else have any solution to this

this is the old thred btw: Update function is not getting called - Unity Forum

Could you post the script, using code tags, please? Thank you.

Share your code and show screenshots of the object(s) the script is attached to. Otherwise we’re just guessing.

Sure, here it is, the logic does work in FixedUpdate() I cant understand what I’m doing wrong in Update =/

7078681–842104–CuttingBoard.cs (1.48 KB)

have you tried simply adding a log statement to Update yet?

    void Update()
    {
        Debug.Log("Update called!");
        GetTarget();
    }

Yes, nothing appears in the console, just if I change to FixedUpdate(); then it shows up

Ive just noticed that the Instanciate isnt instantiating anything evan thou its being called =/

I’m installing 2020.3.5f1 right now to do some basic tests.

ty guys for the help its about 4 days im stuck on this already

This simple script works in 2020.3.5f1, both Update() and Instantiate() are called:

using UnityEngine;

public class Test : MonoBehaviour
{
    [SerializeField] private GameObject objectPrefab;

    private void OnEnable()
    {
        Debug.Log("Hello there!");
    }

    // Update is called once per frame
    private void Update()
    {
        InstantiateObject();
    }

    private void InstantiateObject()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            Instantiate(objectPrefab, Vector3.zero, Quaternion.identity);
        }
    }
}

The problem must be in your script.

Oh wait! Angus, is he on the scene or is it a prefab? If it is a prefab, using FindWithTag() won’t work.


here is the script with FixedUpdate()
notice its running “properly” but clicking the board, not the bull, do not add anything to hierarchy evan thou it prints the “splash”

Same code now in Update()
nothing but the OnMouseDown() runs but it doesnt call what is inside of it .-.

How comes? It is working in all the other scripts also it does work if I change to FixedUpdate(), BTW: Angus is the tag of the bull and yes its a prefab.

I don’t know what to say; it just appears that both Update() and Instantiate() work in 2020.3.5f1.

Maybe you’d need to share your project with someone who is more knowledgeable than me so that they can take a look. You could file a bug report about Update() not working for you in this particular case. Sorry that I cannot help more.

Dont worry, no need to apologize also you did what you could but its really weird, I’ve posted more to make sure it wasnt me who’s missing something dumb about this script because really I’ve tried everything even delete de script and start over from scratch with other names and stuff nothing is helping, ty for all your help guys, I’ll use this post in the bug report.

Looking at your code I suspect that it can’t find the target object, as this would result in no debug output the way you’ve coded it. Try putting a debug.log after
target = GameObject.FindWithTag("Angus"); and see if you get some output in the console.

… and I renounced posting that…

Well, I hope it will fix the problem.

Sorry but the problem isnt to find the target or not, in FixedUpdate() it works, the code finds the target normally, in other scripts it does too and I use the same technic in all of them :frowning:

Is Update getting called in any other script?

You are saying that update isn’t being called as you see no debug log output, but the way you have it currently there isn’t a debug log that covers every condition in your update code.

You need to fix that before you can be sure update isn’t being called.

2 Likes