Testing 2D Lighting with Spriter

Based off of this video.

  • Make sure the Universal Render Pipeline is installed via the Package Manager.
  • Create>Rendering>URP>Pipeline Asset
  • Create >Rendering>URP>2D Renderer
  • Slot the 2D Renderer into the Pipeline Asset.
  • Slot the Pipeline Asset into Edit>Project Settings>Graphics
  • Hit Edit>Render Pipeline>URP>2D Renderer>Upgrade scene or Upgrade game

Annnd…

Our Spriter Character is Lit. But will the lighting remain as animations switch? Well, my existing animator is designed to work not with spriter, but with Unity’s animation system, but let’s tweak it.

Awww yess baybee. I wasn’t sure it was going to work, but it works! Praise be to God!

So I can do fancy lighting shenanigans with Spriter. Theoretically, I can use my palette swapping shenanigans too, which can wait until a game is funded.

This is half the reason I ditched Spine for Spriter. Spine uses a special shader of its own in order to implement its features. But I want to be able to use Unity’s lighting and shaders. Why make an HD game if I’m not going to go all out, after all!

Update

Got basic movement in play. Imported my action/mouse framework and got a cursor moving around on the screen as well, though that’s not in this gif.

Committed the repo before I forgot…

I need water, and my aminals need food.

Advertisement

RPG Menu Notes

Here’s notes from several videos, indicating stuff I want to do or try. Rather than link to each video, let alone an embed, let me shout out EngiGames and Jason Weiman.

  • I want to stick my interface in a separate scene. This is contraindicated by EngiGames for small games, but for my RPG, I think it makes sense to have it be its own thing that sits over the top of everything else going on.
    • using UnityEngine.SceneManagement;
    • if (SceneManager.GetSceneByName("UI").IsLoaded == false) SceneManager.LoadSceneAsync("UI", LoadSceneMode.Additive);
  • Consider, instead, having the menu call Don'tDestroyOnLoad() and then swapping immediately to a gameplay scene, rather than monkeying around with additive scenes, though.
  • If I don’t want to hook up events to buttons using the Unity Button delegates, I can create scripts that handle the button directly. E.g.
    • // In Start(), using UnityEngine.UI...
    • button = GetComponent<Button>();
    • button.onClick.AddListener(YourClickFunctionHere);
  • Obviously, I’ll want to be able to grab an instance of some access point to my menu from any other scene. I should be aware that just putting a reference in a public static field in Awake() is considered a Very Bad Plan. This is because it is a sloppy singleton that doesn’t do the first part of a singleton’s job — ensure that one, and only one instance of the class exists. This video details a singleton generic that will allow you to turn a Monobehavior into a proper singleton merely by inheriting from it.
Continue reading “RPG Menu Notes”

To Everything, turn, turn, turn…

The contentions of this video are twofold:

  1. Choosing a theme is superior to making a resolution. This is because when presented with a fork in the road, it is easier to choose the branch in keeping with your theme than it is to force yourself to take the branch you resolved to take, whether it is there or not.
  2. Consider instead of choosing a theme for a year (or a resolution for a year) choosing a theme for a season. E.g. instead of “I will do 30 pushups a day”, prefer, “this will be the Winter of pushups!” or better yet “the winter of Health!”

I take a definite interest in self-improvement as I fall short on a number of fronts. Fortunate man I, Christ has suffered and died for my many evils. But I still want to better myself for a number of reasons. First of them is: it is good to be good. But more importantly, the better a man I am, the better it is for those I claim to love.

My habit has been making monthly goals, not yearly resolutions nor seasonal themes. And the system has been fruitful, but not as fruitful as I think is possible. I don’t know whether “seasonal themes” is the answer. Right now, I have taken ill and am preparing for sleep, and lack the mental firepower to usefully analyze it. But I have a notion it is more in tune with my natural rhythms, simply because my one-month projects always manage to expand to 3 months. And I wanted to note it down so I can look into it tomorrow, or whenever I am awake and my mind is clear.

A useful data point I keep misplacing.

So you want a field in you Inspector that has sub fields. Its sole purpose is to just be a bucket of data, but you have no real need to share it between classes in Unity or have it be universal in any way.

Sounds like a good use for the C# struct, right?

Nah. Unity doesn’t roll that way. You want a plain old class. No inheriting from MonoBehavior nor ScriptableObject. Just decorate that bad boy with [System.Serializable].

Wait, Unity’s default code files don’t include System? I suppose I can see why, as I haven’t noticed ’til now, but years of working with XNA/Monogame led me to not see that coming…

Do consider, however, whether a ScriptableObject might not be right for you.

Start an Indie Game Studio in 12 Months (Seriously!)

I hate video as a format. I like text because I can read much faster than people can talk (and even speeding up a video, as I often do, I read much faster than I can listen). I like text because I can skip forward and back with ease. And so on and so forth.

Here’s a video I find inspiring and useful.

And now I’m going to textify it for my convenience, then follow it up with some thoughts.

Textify me, cap’n!

A Checklist of Important Details

When using Unity to make 2D Platformers.

  • A Box Collider2D can get the rounding advantages of a capsule collider via the edge radius attribute.
  • A Tilemap Collider2D will treat each tile as an individual collider unless you check “Used by Composite”, which has performance pitfalls and can get you caught on corners. Adding the requisite composite collider automatically adds a rigidbody, so be sure to set that to static.
  • Be sure to set static components (such as large swaths of your map) to static, to enable various optimizations.
  • Be sure to set your player character’s collision to Continuous and interpolation to Interpolate so you don’t have to deal with the Bullet problem.
  • If you want to use Physics2D.Raycast for sensors, and your plan is to start the raycast inside the character’s collider, be sure to deselect “Queries start in colliders” in the Project Settings.
  • Unity doesn’t play nicely with C# events. If you want a public event that multiple entities can subscribe to, look up Unity Events. If you just want one component to broadcast an event to fellow components, it’s easier to just wire them up by hand.