Cast fails if HotReload has changed component type

If you derive your own component from eg. USceneComponent and changes are applied to this derived component. Then after a Hot Reload:

Cast<UDerivedComponent>(FindMyComponent(..))

will always return NULL. So the editor has to be closed, recompiled in visual studio and then it will work again…

Is there a work around to this?

Hi simmania,

Sorry for the delay in responding to your post. Would you be able to provide some additional code showing how you are trying to use Cast in this instance?

Also, what version of the Engine are you using?

[link text][1]

I think, it is also related to some other post of mine:

Here is an output example in xxx.ini file.

Correct:
[Minimal_Default:PersistentLevel.Dome_C_1.ProjectorFront Projector]
Wrong:
[Minimal_Default:PersistentLevel.DisplayOut_C_0.HOTRELOADED_Projector_24 Projector]
Wrong:
[Minimal_Default:PersistentLevel.DisplayOut_C_0.TRASH_Projector_43 Projector]

This is very annoying as it makes saving/loading data on a per instance basis kind of impossible.

Here is another pic.

29609-castfails_1.png

Using 4.6.1

I think the bug is also related to this post :slight_smile:

Another showoff where classes types are changes with hotReload such that all ‘type’ dependent code will fail.

Ambiguous search, could be Enum /Script/DomeProjection.Projector:EResOutputSize or Enum /Engine/Transient.HOTRELOADED_Projector_0:EResOutputSize

Hi simmania,

Thank you for the additional information you provided for this issue. I was able to see what you described, and was also able to cause a crash to occur in the Editor. I submitted a report of what I saw to have this investigated further (UE-10151).

How is this nasty bug still not fixed in 4.7.5? It totally sucks the value out of hot reload… :frowning:

Hi TommyBear,

This particular issue has been fixed internally. When I ran a quick test in one of our latest internal builds, the component was still usable, and did not cause any crashes after its code class was changed and a hot reload performed.

There has been a lot of work put into improving hot reload recently, especially in relation to Blueprints. If you have built the Engine from source code, these two commits were associated with this particular issue. You can merge those into your Engine source code to see if they help, though there may be additional commits I am unaware of that are needed to get it to work correctly.