Hazel icon indicating copy to clipboard operation
Hazel copied to clipboard

OnCreate invoke after all instances created

Open WhereIsMyID opened this issue 3 years ago β€’ 7 comments

Describe the issue (if no issue has been made)

Here is my modification plan after I pushed this issuse -#606 .

PR impact (Make sure to add closing keywords)

List of related issues/PRs this will solve:

Impact Issue/PR
Issues this solves 1
Other PRs this solves None

Proposed fix (Make sure you've read on how to contribute to Hazel)

I splited the method "OnCreateEntity(Entity entity)" into "CreateEntity(Entity entity)" and "OnCreateEntities()". One is to register all instances in the instances map, another one is to invoke their OnCreate() function.

Additional context

Add any other context about the solution here. Did you test the solution on all (relevant) platforms? If not, create a task list here.

WhereIsMyID avatar Jan 11 '23 08:01 WhereIsMyID

You must have done something wrong in your code, because I have tried to replicate your issue and I just cannot replicate it :/ I have even tried your "fix" and it does absolutely nothing on my 1-1 copy of little Hazel :(

VagueLobster avatar Jul 23 '23 13:07 VagueLobster

You must have done something wrong in your code, because I have tried to replicate your issue and I just cannot replicate it :/ I have even tried your "fix" and it does absolutely nothing on my 1-1 copy of little Hazel :(

This is a logical issue with program execution. For example: There are two GameObjects A and B in the scene. We assume that A is created before B. There is no problem to use "GetComponent" from A in the OnCreate() function of B, but if A want to get a component from B or get the instance of B, there will be fail, because B was not yet created when A called the OnCreate() function. I hope u can understand the meaning of my above paragraph :)

WhereIsMyID avatar Jul 24 '23 02:07 WhereIsMyID

Yeah I think I get the gist of it, I just cannot replicate it for some reason... Like I said, it works fine for me...

VagueLobster avatar Jul 24 '23 09:07 VagueLobster

And I think I know why I cannot reproduce the error... Yan has updated a lot of code when he went on to create the Asset Manager System, and while he did that, I think he has updated some of the code in Scene.cpp(?) which happens to fix the Hierarchy turning upside-down every time you save! So with the new code the Hierarchy only turns upside-down whenever you run the scenes! That could be it! But don't think that you can settle with just downloading the asset-manager branch and all is good, because you will need to watch the latest VOD on twitch, since Yan hasn't uploaded it yet to youtube! And if you don't know it, the VOD is only up for a total of 60 days on twitch, and it has already been 14 days since he streamed it! Hope this helps πŸ™‚

VagueLobster avatar Jul 24 '23 09:07 VagueLobster

And I think I know why I cannot reproduce the error... Yan has updated a lot of code when he went on to create the Asset Manager System, and while he did that, I think he has updated some of the code in Scene.cpp(?) which happens to fix the Hierarchy turning upside-down every time you save! So with the new code the Hierarchy only turns upside-down whenever you run the scenes! That could be it! But don't think that you can settle with just downloading the asset-manager branch and all is good, because you will need to watch the latest VOD on twitch, since Yan hasn't uploaded it yet to youtube! And if you don't know it, the VOD is only up for a total of 60 days on twitch, and it has already been 14 days since he streamed it! Hope this helps πŸ™‚

Maybe so. I published this issue last year. I'll look at the current source code again. Thanks for communication. :D

WhereIsMyID avatar Jul 24 '23 10:07 WhereIsMyID

My pleasure πŸ˜„πŸ‘

VagueLobster avatar Jul 24 '23 10:07 VagueLobster

Maybe so. I published this issue last year. I'll look at the current source code again. Thanks for communication. :D

I have just found out that I made a slight bummer ☹️It's the VOD from 21 days ago today that is the last little Hazel VOD, sorry about that!

VagueLobster avatar Jul 24 '23 10:07 VagueLobster