After SetActive(true) Update doesn't work

Hello, I have a strange problem with Unity5 and I found several related threads but none seem to apply to my case.

I have started to implement object pooling in my project and have run into a problem. To keep it short, the object pool script uses SetActive(false) when instancing objects, and when spawning them I use SetActive(true), however this does not make Update function start working.

ObjectPoolScript.cs - C# object pool script, component of ObjectPoolManager object.
ObjectPoolManager.js - js script, component of ObjectPoolManager object
BulletScript.js - script attached to the prefab being pooled.

The object being spawned is a simple prefab with no children, and a script attached has an Update function which works fine when instanced by usual means, however it stops working when object is set back to being active.
As a test I added coroutine to BulletScript which calls Update function in intervals but that doesn’t work either.
As another test I added coroutine to the BulletScript which does everything Update does in regular intervals, and this works just fine.
But I would rather stick with the Update function, as I use deltaTime often, while if I were to transfer to coroutine (I assume unlike Update, coroutine is constantly called in regular time intervals) I would have to do tweaking all over again.
In any case there is no reason why Update shouldn’t be working after setting the object back to active. Like I already mentioned the prefab being spawned is one single object and the script is attached to it, so enabling that object should enable the script’s update function as well. I’d like to add that pool script is written in C# while rest of project is in JS, SetActive(false) is called from CS while SetActive(true) is called from JS, could it be that this causes some unpredictable bugs?

Any ideas please?

Can you post some code?

1 Like

Thanks for making me look at the code again, it was some mess up involving if weaponClass!=null (which never worked) and bad usage of subroutines, a useful tip to anyone who run into similar problem I guess would be always suspect your code.