andykorth

@andykorth@mastodon.gamedev.place

Verdant Skies Dev - indie game dev - VR dev at FireflyVR - Howling Moon Software - he/him

This profile is from a federated server and may be incomplete. Browse more on the original instance.

peterdrake, to unity
@peterdrake@qoto.org avatar

It's a common practice in Unity to start the name of a scene, prefab, etc. with an underscore so it will be listed first in the project window.

This is because things are sorted lexicographically and underscores come before letters in ASCII, right?

Well, no.

https://www.asciitable.com/

So what the heck is Unity using to sort things? Did they ... did they really add the underscore as a special case?

andykorth,

@peterdrake I suspect they are just sorting the way the .net does, for example:

string[] words = new string[]{"_b", "B", "a", "a", "c", "C", ""};
Array.Sort(words);

Sorts out as:
"_, _a, _b, a, B, c, C"

So not in ascii order at all, otherwise all capitals would be before any lowercase.

The other fun thing was.. back when Unity was Mac only, we started our objects with an asterisk instead of a _. But windows does not like that!

andykorth,

@peterdrake @LouisIngenthron
You can find information about it by looking for "sort collations". Unicode does define one (the Unicode Collation Algorithm)

I think C# matches the SQL stuff microsoft provides here, but I'm not sure:
https://learn.microsoft.com/en-us/ef/core/miscellaneous/collations-and-case-sensitivity#database-specific-information

A lot of it is, understandably, complicated by different locales. (where does á sort vs. a?)

aeva, to random
@aeva@mastodon.gamedev.place avatar
andykorth,

@aeva Unity version :D

peterdrake, to unity
@peterdrake@qoto.org avatar

Fun tidbits from the docs on MonoBehaviour:

"This class doesn't support the null-conditional operator (?.) and the null-coalescing operator (??)."

There is a cryptic note that "There is a checkbox for enabling or disabling MonoBehaviour in the Unity Editor. It disables functions when unticked. If none of these functions are present in the script, the Unity Editor does not display the checkbox. The functions are:

Start()
Update()
FixedUpdate()
LateUpdate()
OnGUI()
OnDisable()
OnEnable()"

It does not say where this checkbox is, nor why you would want to do this.

andykorth,

@peterdrake Those types of things are typically not really mentioned in the Unity scripting reference docs, you will need to rely on a mix of videos, Unity forum posts, and random social media posts.

If you were curious, that checkbox is at the top of inspector entry for each script. Here's an image of a script with and without one.

andykorth,

@peterdrake @LouisIngenthron @bernardo_olafson
The manual pages (rather than scripting reference) is generally better for high level stuff. Pages like this one: https://docs.unity3d.com/Manual/ExecutionOrder.html

The overriding of the null comparison has been an oddity with many unexpected side effects and has been discussed for many many years. It's definitely a doozy :D

Teri_Kanefield, to random

deleted_by_author

  • Loading...
  • andykorth,

    @Teri_Kanefield That's my plan too! So far so good!

    Nifflas, to random
    @Nifflas@mastodon.gamedev.place avatar

    I want to share a discovery I made on twitter, but turns out it works on Mastodon too!

    I have figured out how to embed a videogame in a toot. Here's a proof of concept I made: An Asteroids clone set in a universe where time doesn't exist.

    You can try it right here! Enjoy!

    andykorth,

    @Nifflas A refreshing change from all those Asteroids clones where time advances normally!

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • mdbf
  • InstantRegret
  • ethstaker
  • magazineikmin
  • GTA5RPClips
  • rosin
  • modclub
  • Youngstown
  • ngwrru68w68
  • slotface
  • osvaldo12
  • kavyap
  • DreamBathrooms
  • Leos
  • thenastyranch
  • everett
  • cubers
  • cisconetworking
  • normalnudes
  • Durango
  • anitta
  • khanakhh
  • tacticalgear
  • tester
  • provamag3
  • megavids
  • lostlight
  • All magazines