FTickableGameObject::IsTickableInEditor() doesn't work

Please, check this topic from 2014:

Why is this behavior still occurring? It’s really strange that it need any additional logical implementation in this very function, returning false/true should be enough.

Is this issue reported? Or is it intended to work like that? Could you add it to official issues?

Hey

Can you provide the code and setup you’re using to test this. Can you describe the behavior you’re seeing on your end when you test this as well?

I will do it after a weekend, my workspace is not available right now. Thank you for your interest!

Hey -

We’ve not heard from you yet. Can you provide the setup you’re using to test and the results that you’re getting? Please let me know if you have any information you can add to help investigate the behavior of the IsTickableInEditor() function.

Hey , thank you for your interest in this topic!
Actually, I have prepared a fresh build for you, on a new project. I wanted to upload it but a lot of work got me recently. I was testing the build a little bit and I can’t explain a few things. I also found that I wasn’t creating an UObject correctly within my GameMode class, which may also have an influence in the result. So, of course, the theory brought me only a headache and a lot of doubts in my understanding of things.

Do you have any idea how to test ticking within the editor in a proper way? I don’t even know which class could I override to get into the editor.

I think I will just upload my project in a minute, just to give you any idea how it went. But be aware that it’s not as clean example as I would like it to be. So, I’m sorry, I failed.

Here’s the project:
https://drive.google.com/open?id=0B6mWbo1UfZkJYXRrSXdCU3I2a0E
(don’t forget to generate vs project files).

I need your help to explain a few things!
You should focus on 2 classes: TickBugGameMode, MyTickableObject.
I added bIsTicking to control the IsTickable() function.
In the GameMode, timer is firing OnToggleTickEvent() every 3 seconds (but only when player is in the game, maybe it’s not quite what we want).

  1. There is that weird thing with initialization of “bIsTicking”, when initialized to true in ctor, the event switching it doesn’t work (it’s possible to switch bIsTicking off inside the tick, though). Try to change initialization in code to see the results.

  2. Try adding this code in UMyTickableObject::IsTickable():

    if (bIsTicking) {
    UE_LOG(LogTemp, Warning, TEXT(“IsTickable() called: true;”));
    }
    else {
    UE_LOG(LogTemp, Warning, TEXT(“IsTickable() called: false;”));
    }

You will get some crazy results! It’s called too many times with weird returns. How is it even possible that a member variable is being changed from… nowhere? When bIsTicking was initialized to bIsTicking(true) it’s oscillating and can’t be switched off…

If I recall anything else I will write. But there is too many weird things I can’t explain to make a clear statement whether it’s a bug or not.

When I opened the project you provided I noticed IsTickableInEditor(0); being printed in the output log. In MyTickableObject.cpp when I change the return value of UMyTickableObject::IsTickableInEditor() from “false” to “true”, I instead see IsTickableInEditor(1); being printed. Additionally, when I add the UE_LOGs from your previous comment, I get the IsTickable() called: true; text printed regardless if IsTickableInEditor is returning true or false. If this is not the same behavior you’re seeing, please explain what I should be looking for in this project?

Yes, it is correct behaviour.
The problem is, that this very UE_LOG which shows IsTickable(1) and IsTickableInEditor(1) is placed in the Tick() function itself. So whenever you see IsTickableInEditor(0) printed in log inside the editor, that’s wrong.

It seems that this TickableObject doesn’t detect that it’s ticking in the editor. The only way of controlling it in this situation is to control IsTickable() to return true only inside the gameplay (for example in GameMode’s function PostLogin() ). But it shouldn’t be like that in my opinion.

Nevertheless, I abandoned that solution in my project, so it’s not a problem for me anymore. If you want to investigate the case further, go on please.

Thank you kindly for your help, ! I really appreciate it! :slight_smile:

Hey -

I believe I misunderstood your original report. I was able to reproduce the issue where setting IsTickableInEditor to false did not stop the object from ticking (I thought you were trying to get an object to tick, thus my confusion.) This has been reported here: Unreal Engine Issues and Bug Tracker (UE-40421) . You can track the report’s status as the issue is reviewed by our development staff. Please be aware that this issue may not be prioritized or fixed soon.

Cheers