real quick we got a super chat from Sean
Thank You Sean
does it matter in terms of performance
if you instantiate a bunch of objects in
awake versus a start no as far as both
go all awakes up and then all starts
happen and that happens pretty much
beginning of your application so there's
as much of the performance cost as there
is to instantiate that many objects not
really the the location that matters I
will say though so in order of
precedence your ideal scenario is to
have stuff pre instantiated in the in
the hierarchy so you don't have to
actually go and go through an
instantiation step preferably as well
I'd say look into this if you're worried
hierarchies can cause issues with moving
objects people don't really think about
it but unity does an event system that
goes up and down for the objects in the
hierarchy so if you have a load of child
objects it may look neater in a lot of
cases to put a folder and put all of
your bullets under it I know I like
doing that myself but it is worth noting
that when objects move they dispatch
events to say where they are relative to
parents and children
so wherever possible it's actually
better memory management perspective not
to have objects nested deep into
hierarchies of neat folders especially
if the runtime objects where you're not
gonna be looking at the hierarchy anyway
as for actually instantiating the
objects I mean if you have to
instantiate stuff you have to
instantiate stuff preferably do it full
wise instantiate and turn off renderers
and work with them when you need to by
by reactivating them but as for when
your start frame is going to be your
star frames doesn't matter which awake
or start you use it's just gonna be the
beginning of your application just try
to avoid iterating and instantiating
midway through a running application
because you will get hitches your
application will do that really small
judder that makes it look like it's you
know do do badly performing or something
you know one thing I like to do to
address that because I also like to nest
everything I like to keep everything
real neat is I will put a Blaine
gameobjects that I make editor only and
I'll just put like a bunch of lines to
kind of like treated like a separator
you know I mean yeah and that that I
really like also I was trying to get an
affiliate link I like to use tools like
I was that rainbow hierarchy Pro or
hierarchy first yeah I was gonna say hi
same with the dots actually I don't like
my okay sorry buddy I should do the same
thing like you'll see a lot of
programmers will do that in unity mm-hmm
they will have some leader using
asterisks or a dash and there makes
separate aligners between objects um it
looks nice but it's basically creating
object for no other purpose and to make
you feel better about the way it looks I
know and unlike code where you can kind
of get away with having slightly more
verbose when it's not going to cost you
I try to avoid doing that where possible
I have to fight my instinct for really
clean and structurally nice things when
it comes to memory management it's just
gonna be a trade-off you'll have to do
but you start spinning off the larger
project oh yeah I do the same things you
I've switched over to using something
like rainbow hierarchy because it'll let
you highlight and define separations
that'll only exist in the editor and
won't carry over in terms of memory to
your game there is a link in the
description of this video I do have like
a section called I think it's called
assets that I love or something like
that and you can check it out it's like
hi it's called higher Pro hierarchy or
something like that but it's pretty it's
pretty great
look someone says a few oh hey guy a few
important tips to mention for
hierarchies you can add a script to push
out all your children out of a folder
objects at runtime and make hierarchy
editor folder object titles okay that's
interesting
I mean trick it's cool but again like
you're adding work the technique does
need to be done I mean if you're really
pedantic about having a huge hierarchy
of objects that you're worried about I
guess that's a good idea I just try to
avoid it and example if they're if their
manager scripts or helpers I don't mind
if hierarchy is nested ten deep in a
very kind of small hierarchy that's okay
the only time that I'm worried about
things being nested in the hierarchy is
when they are I call them actors i
define actors
things which have a presence in the game
that will be moving around physically
that arm is going to be static that are
in health version mana classes they're
the ones you want to avoid dispatching
or necessary events for but things like
manager classes and stuff to get higher
I'll go really ham and have really neat
folder structures of underscore logic
for certain areas of the code or you
know managers under a different service
all this kind of stuff it's only the
entities themselves all its characters
enemies whatever those ones I'll just
pretty much dump into the into the
hierarchy or I will run a spawner
instantiate them and cool them or
something yeah
[Music]
you