Show newer

@peterdrake No, I don't think so. It would only be to check if a singleton from a previous execution context was still stored in the static reference.

But it's worth noting that there are a number of places where OnDestroy may *not* be called (mostly in-editor, not in-built-game, such as hard exits).

@peterdrake On 1, correct. That's why I usually make the singleton property a public get but a private set. With the pattern above, that achieves the same goals.

On 2, it's to specifically use Unity's overloaded null checks to make sure it's not pointing to a dead/destroyed reference before checking equality. I'm not sure if the straight equality check does that, so I added a null check as a short-circuit.

I wonder what percentage of people who think gender-affirming surgery is unnecessary and barbaric also think that circumcisions are perfectly fine...

once i develop object permanence, it's all over for y--WAIT WHERE'D YOU GO, WHAT IS HAPPENING

@jann Wait, how is not watching their shows supposed to support them? If anything, that just makes it more likely they'll be cancelled, right?

@peterdrake Basically, the key is to make sure to clean up after yourself since the editor won't do it for you. So, if you have a static score integer, make sure somebody's start function resets it to zero. Stuff like that.

@peterdrake Oh, you still have to use statics, you just have to be smart about it. This is the pattern I use that hasn't failed yet. Put it in the Start() function of MonoBehaviours. Try to avoid singletons of non-unity-managed-objects (you'd need a different pattern than the below).

if(Singleton == null)
{
Singleton = this;
DontDestroyOnLoad(gameObject);
}
else if(Singleton != this)
{
Destroy(gameObject); // two in scene
}

As long as you do that for Unity objects, that first null check will use Unity's override == check to also check for destroyed or unreferenceable objects.

And then in the Destroy function:

if(Singleton != null && Singleton == this)
{
Singleton = null;
}

@peterdrake Except then static variables persist between sessions, which can easily break poorly-implemented singleton patterns. Be *very* careful.

If your builds are taking a long time, I highly recommend letting unity refresh the Library folder (just close Unity, delete the library folder from your project, and re-open unity). It'll take Unity a while to rebuild that folder, but then script builds should be *much* faster for a while.

I'm really not a fan of filtered posts showing in my timeline as just "Filtered".

Either they shouldn't show at all, or they should say why they were filtered and have an option I can click to reveal the post.

By telling me it's filtered, but not telling me why, it just piques my curiosity, for content that almost certainly holds nothing of interest for me.

@casastorta That's a particularly strange flavor of bigotry there... 🤨

@casastorta Sure I do. But an official language isn't worth jack squat if nobody speaks it. You need people to speak the language before making it official, not the other way around.

@casastorta For the reasons I outlined above. To be useful as a language, you need good coverage in the population, but you can't attain that coverage without utility and you don't get utility unless its a primary language somewhere you want to go.

In other words, what is a European's incentive to learn Esperanto over, say, French or Spanish?

It sure is nice of Elon to label all his worst failures with an "X" for us.

@casastorta Nothing. I was answering your question. Esperanto won't take off as a secondary language without being native somewhere.

Learning a language is a difficult, tedious process. If someone's going to learn a language, they're going to learn one with utility in mind, i.e. something they know they can use in a certain place.

There is no such place for Esperanto, so it remains in obscurity.

@casastorta Because a language needs native speakers to popularize it. Without native speakers, Esperanto will remain obscure.

@NPR Reason #5: Long-term rentals are being taken off the market so their owners can claw and scrape more money out of them as short-term rentals (i.e. airbnb).

My brother & dad got me hooked on Forensic Files as a good series to have on in the background, which is what I was doing while working today... only to recognize the location in the episode where the body was found. It was where I went to camp as a boy scout when I was younger.

Man, we could have had some *great* ghost stories if I knew the campground was a literal murder graveyard!

Took a flight test this morning, ever closer to my first solo flight. Got three safe landings in all by myself, despite a few small mistakes, so I'm pretty happy.

Show older
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.