Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Latecomer to Chop Chop, with a question...!

Discussion in 'Open Projects' started by Reverend-Speed, Nov 5, 2022.

  1. Reverend-Speed

    Reverend-Speed

    Joined:
    Mar 28, 2011
    Posts:
    284
    Hey folks. I've been poking around in Chop Chop as a means to educate myself a little about the use of Scriptable Objects. I expect I'll have more questions as I explore it further, but initially I was wondering...

    1) I'm currently experimenting with the releases for the Game Architecture and Complex Input videos. Is there a release anybody would suggest I focus on, with the best documentation and complete features?

    2) In a project with such an emphasis on Scriptable Objects, why is DontDestroyOnLoad being used so much? I have the Initialisation scene running (which has loaded the Main Menu scene) and there's three GameObjects under DontDestroyOnLoad... Shouldn't these load and stay in the Initialisation scene? (Which is not SetActive)

    3) Can anybody give me a brief explanation of what the goal of the DelayedActionManager is? Or what MonoBehaviorCallbackHooks is for? I haven't been able to find documentation (EDIT: Just found the wiki, will look through it for those pieces of code).

    4) Through examining the scripts, I've discovered CompnentSingleton<T>, which seems like a built-in generic singleton of the type I've seen taught in Unity Learn - and which automatically calls DontDestroyOnLoad. That's handy, but are we not trying to stay away from DontDestroyOnLoad?

    I've a fair amount of experience with Unity, but I'm self-taught, so there's likely to be a great amount I'm not understanding here. Any feedback is appreciated.

    --Rev
     
    Last edited: Nov 6, 2022
    Artist_Karce and JesterGameCraft like this.
  2. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    452
    Hi, I'm also trying to get more info on these. Can you please share the wiki link about item #3?

    Update: From what I can find the following three are part of Addressables package that I'm using:

    ResourceManagerCallbacks (references MonoBehaviourCallbackHooks script)
    EventCollector (references DiagnosticEventCollectorSingleton script)
    DelayedActionManager (references DelayedActionManager script)

    Does anyone know if addressable create these by default, and if using addressable you're pretty much using DontDestroyOnLoad?
     
    Last edited: Dec 12, 2022
    Artist_Karce and Reverend-Speed like this.
  3. Reverend-Speed

    Reverend-Speed

    Joined:
    Mar 28, 2011
    Posts:
    284
    This is the best introductory tutorial I've found on Addressables. DontDestroyOnLoad is fundamentally different, as Addressables are basically about being able to load AND unload assets into memory. This allows you to load tiny amounts of assets for, say, the starting menu of a project (reducing load times), or do things like have a cutscene where you destroy your house - and then unload the house from your system memory when you don't need it anymore, saving memory.

    DontDestroyOnLoad just keeps GameObjects and associated scripts in memory, even when nothing is directly referencing them (basically keeps Garbage Collection from affecting the GO).

    Basically, just watch that tutorial linked above.

    I got to the point where I abandoned trying to get some kind of useful framework out of Chop Chop (outside of some overall scene layout / scriptable event system stuff) as I kinda got depressed about trying to study this half-baked example. Addressables are interesting and useful (that tutorial's great), but a lot of it isn't massively relevant if you're working on small to medium projects (or so I've concluded).

    Basically, I wasted a bunch of time researching something that was not immediately relevant to me and still getting changed around / developed by Unity, so I'd have been better off holding out for another year or so until the more stable versions are being used by everyone, accompanied by clear, consistent, up-to-date documentation and tutorials.

    /rrgh
     
    Artist_Karce likes this.
  4. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    452
    Thank you for spending the time to find the tutorial. I'll check it out. I'm sorry to hear about Chop Chop, I know how frustrating it can be to invest time into something and then find out it was all for not. At least you got something out of it. About Addressables I created an empty scene and assigned a cube as addressable asset and sure enough DontDestroyOnLoad was not present. I just assume it was used by addressable internally but that is not the case. I'll have to go through my main scene and I'll use process of elimination to find out what is generating DontDestroyOnLoad object.

    PS. Don't get discouraged there are other unity projects out there that might be helpful. Keep learning and never give up. Some encouragement (I think)
    .
     
    Reverend-Speed likes this.
  5. Reverend-Speed

    Reverend-Speed

    Joined:
    Mar 28, 2011
    Posts:
    284
    Aw, that's very nice of you! "Fall down seven times, stand up eight", as they say. =) Nah, was just annoyed I'd chosen to learn about this particular part of the technology at this particular time - but it's still useful. Thanks for the encouragement, friend, and the best with your own project...!
     
    JesterGameCraft likes this.
  6. Reverend-Speed

    Reverend-Speed

    Joined:
    Mar 28, 2011
    Posts:
    284
    I should say, btw, there's a ton of other uses for Addressables other than the examples I gave above, it's a very useful technique at a certain scale!
     
    JesterGameCraft likes this.