#Tile Selection

1 messages ยท Page 1 of 1 (latest)

hoary ridge
#

Made a thread here. I can send an example of it.

bronze coyote
#

awesome

#

good idea to not clutter chat more

hoary ridge
#

I just got to work on the rotation part for an isometric example.

But I do got it where you can draw a box in a couple lines of code using Handles with just tile information.

#

Since I had access to the Tiles I instead went down the route of creating a rect that matches the size of the selected tiles.

Handle.DrawSolidRectangleWithOutline() is what I went with.

I noticed Unity documentation about it is missing some one of the overloads though.

bronze coyote
#

ok that makes sense

#

sadly that isn't isometric

#

which has been my problem

#

normal tilemaps seem easy

hoary ridge
# bronze coyote sadly that isn't isometric

Yeah, so the last step I was working on is the rotation part. Making it work for isometric made me realize there might be an easy approach to it.

Looking into the grid API I think I might have an idea to do it in less than 10 lines of code.

bronze coyote
hoary ridge
bronze coyote
#

yeah sure I can get that for you

#

im very excited, im also hoping i can adapt your work towards multiple tilemaps that are stacked ontop of each other

hoary ridge
#

Want me to convert the example into a utility function.

This way it can be called by any script.

bronze coyote
#

Sure why not! Means I could use the code elsewhere

bronze coyote
#

if you need help btw, i feel really bad that you are just doing this all for me

#

i dont mind trying to help out

hoary ridge
#

Sorry for the delay I didn't get a thread notification for some reason like normal.

I actually have been making Sprite Tools and utility features in editor as a package I am planning to publish for free to download.
Was going to have to investigate this area anyway because I was doing custom tools that are one line Handles features.

Example a handlefeature that draws an Arc shape over the scene view that can be rotated, dragged to change angle, and pulled to make bigger.
The example I had for this handle was line of sight detection tool that you could visually debug in scene view for smart AI with sight.

bronze coyote
#

Gotcha! That is super dope to make tools like that for free

hoary ridge
#

I got some free time after I finish a work task today in a couple hours. Will make a video and see if that is what you are looking after.

And the tool thing I am working on is mainly for unity 2023.2.
Chose to mainly support it in newer because no more major UI Toolkit or Text Core refactoring is happening after it. Just updates and smaller features for a bit, but no complete from ground up reworks.

bronze coyote
#

dope that is a very valid reason for the version choice

hoary ridge
#

So got a set Unity Editor Utility tools that will be getting examples for handles (one example is actually your question), asset database utilities, scene tools in the form of the new tool overlay option, and some file tools for easily finding assets paths/guids a lot easier.

After discussing with people how to handle stuff for the community I ended up doing the following. Will be making the package as a Unity Package so people can install it via the package manager and easily get updates.

The packages are separated into different ones so people that only want part of the tools can just grab the ones they want. I will be using GitBook to make documentation public for people over time to help. The documentation is actually usable with Unity components. The question mark in the inspector will end up brining up the documentation for people from Unity Editor.
Example picture for the question mark I mean.

I already created the base package mark down files Unity requires for custom packages and made a Github repo for it that is public. I just need to move the scripts to it, add comments to the scripts for helping people see them, and than clean some of them up.

hoary ridge
bronze coyote
#

Oh that's so awesome!

#

I'd love a link to the package when you finish it up

#

Also if you have a Kofi or something I'd love to support you

hoary ridge
#

Is the UI Toolkit version of the custom handles okay with you. We are focusing on the UI Toolkit versions before the IMGUI versions?

And thank you for the Kofi offer, but I don't think we are ready to do that yet, we want to make sure the tools have a good foundation that can help the community And man we got a lot of debugging on possible versions of Unity older than 2023.2 down the line.

bronze coyote
#

and yeah the ui toolkit sounds great to me lol. I just was trying to show 1 thing lol

hoary ridge
# bronze coyote oh you have a team its not just you?

So I am slowly becoming the main tool developer or core systems dev for my team. Basically I am making editor tools to make development easier and faster.

Example I have been making a new tab for the sprite editor. It has new features like editing multiple sprites at once instead of being stuck editing one value at a time for things like sprite name, pivot point, and rect transform.
Adding new stuff for Tile Map Editor. Most them QOL of life stuff like adding shortcuts to quickly switch between what tile mapping it being worked on, and new tile brushes for faster stuff. The Tile brushes are actually related to minimap for the metroidvania project.
It is a brush that adds allows me to paint on a grid that acts like the minimap structure to create new rooms, transition points between rooms, and so forth.

The picture is not impressive yet thanks to just starting this last night. Started making my UI Creator settings inside of Unity project settings. The UI Creator is a tool that is the basis for my stuff. I made it to quickly allow for making new editor tools or inspectors with little effort. The UI Creator also has a test custom graph tool system in it to create graph features like AI Behaviors, Dialogue, and event Sequences.

The UI Creator has the handles examples being worked in it. The UI Creator also has overlay features for making scene tools like Handles, Gizmos, and Toolbars.

bronze coyote
#

Thats really cool!

hoary ridge
#

Alright so se will do some more testing and add a couple more than I will drop a link. Basically remade an internal class that was not usable outside of Unity core scripts.
These work anywhere that any GL commands work....so most places.

The DrawGridMarquee takes in a grid layout which TileMaps inherit from so you can pass a tile map into it. It checks what the orientation is like rectangle tilemap, hexagon, special iso and so forth. Pass in the bounds int area of the selected tiles and the color you want and you get your tile highlight.

I am working on an extension to let people just pass in a list of tiles and colors to make things easier to work with.

#

Oh i also used raw GL commands for the rendering so the code works in runtime. This let's people do highlighting, selecting outlining, and so forth during play mode and in a built game.

bronze coyote
#

this might legit

#

change entirely how my game works then lol

#

cause i had to redo an entire system since i couldn't figure out highlighting

#

i used to use a transparent overlay tile

#

but when i switched to 2.5D it all broke because of z fighting

hoary ridge
#

Yeah, so Unity has a function called DrawGridMarquee, but it is an internal marked function so normal devs can't use it ourselves.
The three images show the following that I made and still updating. It alreadys works, but adding more overloads to make it easier and more versatile.

The Grid Locals is a struct that takes in a grid layout and will automaticall calculate certain parameters needed for highlighting. Do note the one I took a snap shot of is the Grid Locals for Rectangle shaped TileMaps if the math seems off when doing Hexagons that is why.

There are a set of Grid helper functions that I made when ever people need them for calculating Vertices needed to be drawn for the selected amount of tiles and helpers for getting swizzle cell offsets for hexagon shaped tile maps.

The DrawGridMarquee function is basically Unity internal version pulled out and updated to use the new helper functions I wrote. These are made in a way that most of the draw functions don't require editor only, but can freely work in runtime.

Basically you can either shove in a boundsint with the grid layout, or you can pass in a array of tiles to be highlighted with the grid layout.
The TileMap class inherits from grid layout so most likely in your case you would base the tilemap instead of a grid layout that holds the tiles to highlight.

Due note the class is called SFEditorGridUtility, but most of the functions in it work in runtime so no need to worry about the editor only side of things. I got Editor if directives surrounding the editor only code.

Basically it looks like this when you need to highlight tiles.

SFEditorGridUtility.DrawGridMarquee(tilemap, array of tiles to be highlighted, and the color of the outline)

Currently working on allowing the ability to draw a fill color and an outline color at the same time.

bronze coyote
#

So how are you able to call this method that is normally hidden then?

hoary ridge
# bronze coyote So how are you able to call this method that is normally hidden then?

I rewrote it into my own Utility function and changed it a bit to work with runtime.
So now there is a public static version of it with tile Array overloads with my custom code inside of the SFEditorGridUtility.
The SF stands for Shatter Fantasy. It is the name of the studio that is being made. We are adding SF in front of a lot of the utility/helper classes to prevent ambigious naming conflicts in the compiler.

bronze coyote
#

Ah that makes sense. And it's also good as a form of recognition

hoary ridge
#

This will be the future link of the tools. They are not pushed up for public release yet so the repo is empty, but finishing the last of what is needed today during a test stream.
What is there was just for testing purposes to make sure the package JSON works.

I need to do some testing on multiple versions of Unity to make sure it has no problems and test a couple platforms today for things like WebGL and WebGPU.
Also having to split a couple files. Moving some things into new scripts that way people don't have to reference a big script for certain features like 2D only gizmos.
I will message here when it is done and can be pulled into Unity via the Package Manager.

In the end you will be able to go to the package manager tab, choose install from GitHub in the menu to add a new package, than put in the Git URL for the package which should be this.
https://github.com/Shatter-Fantasy/SF-Utilities.git

Full disclaimer. I need to clean up code that was being used partially than reworked to make it more flexible since somethings were originally going to be editor only than managed to use GL commands to make them work in runtime.

GitHub

Contribute to Shatter-Fantasy/SF-Utilities development by creating an account on GitHub.

bronze coyote
#

Let me know when its all done! I have been really excited and even trying to take a peek at the github repo

hoary ridge
#

So I am actually asking some people in Unity about a community package update for the 2D tools. Here is one example of the update.
The picture shows a WIP update I am doing for Sprite Editor as a community package. The picture shows a few different sprites that are highlighted red.

I added the ability to select multiple sprites at once to edit their values. Pivot points, names, rect sizes, and so forth.
The green highlighted sprite is the one last selected. At the moment using a hot key shortcut you can click on a sprite rect and add them to a selected sprite list and do callbacks on their values at once instead of editing sprite stuff one by one.

The next step is tile map creation. You will be able to select multiple tiles and hit a create tile asset from the selected tiles. Example you can select nine tiles and choose to make a rule tile from them automatically. This lowers the steps needed for 2D by removing pain points for sprite editing and tile creating.

bronze coyote
#

oh thats awesome!

bronze coyote
#

I assume you are just trying to rap up all the features before pushing out to the whole package?

hoary ridge
#

Yeah, Version 1 is almost done. I think less than a week. The goal is to do a pre test Saturday this week.

bronze coyote
#

I hope it is still going strong

#

also would love to catch a stream to see you testing it in action

bronze coyote
#

i still believe in you btw! I hope life is going ok

hoary ridge
#

It never gave me a notification on Discord that I got a response. Randomly just checked to see you messaged. I can give a nice update on a lot of stuff.

First major thing to note we split the systems into seperate packages. This allows people to only used what they want when needed. Some packages auto reference other when needed and loads them in to prevent missing Assembly Definitions.

There is the first package that is the SF Utilities. It has some of the following.

The one you care about most likely. The Graphics Library classes. I pulled out a lot of functionality Unity had marked internal so we couldn't originally use the API.
Some of this API is for the highlighting and selecting of objects. There are functions for highlighting things like Tiles on a Tile Map, normal game objects, and more.
This can also allow custom Gizmo materials so you can change the size, shape, and other properties of the line rendered for the outline of a highlighted object.

File Utility Class:
This has things for creating folders at a path, checking if a folder path is valid, and keeping track of the Unity Project folder path.
Think of the assets and packages root folders. This can be use for some editor tools to help make sure paths that need to exist to create an asset in the project are actually there and if they don't exist than make it for the developers.

Editor Utilities:
Functionality to remove invalid characters from file name.

Serialized Property Extensions:
Has functionality for getting all the children serialized properties from a serialized property so nested variable structures while allowing a max depth to find those properties at.
This is used in a lot of stuff for the custom Sprite Editor.

Asset Database: Side note some of this works in runtime not just editor only. So some Asset Database stuff can now be run during runtime.
This has functionality for finding type of objects in the project/packages folders. Use this for Finding Scriptable Objects that act like settings containers for databases and RPG Editor tools that I was making.

Also has functionality to create a scriptable object if no type of it is found in the assets/packages folder during a search than returns the new asset created to prevent errors.
This also has some useful folder searching functions as well. Basically extended the Asset Database to allow for searching for a type instead of a name and return different data like folder paths other assets near it in the same folder and so forth.

Lots of math utilities thanks to handles and sprite editors. Mainly helper functions for Vector 2/3 and Bounds.

There are a lot more. The utility package go public next week on Thursday for the community to use. We will release the UI Toolkit stuff for custom UI systems after iterating on it a bit more.
We are updating it because I have been writing an entire custom Sprite Editor, Tilemap Editor, and more 2D tools from scratch.

bronze coyote
hoary ridge
#

Yeah, got to admit was a bit hard to dive into the internal graphics formula they used for the selection of tiles. It was interesting to say the least.

bronze coyote
#

that is very fair lol. I have tried to look into graphics coding and just like got so confused

hoary ridge
#

So legit for the selection tool in Unity for sprites, tiles map when painting on a tilemap, and normal gizmos all Unity is doing is directly calling a GL command to the Graphics Card directly.

Example in the Sprite Editor the border rects around the sprites are pure calls to the GPU to draw a line one pixel at a time.......

Basically how it works is Unity allows you to apply a shader to a material and this material is applied to the Graphics Matrix on screen to match the position of the area on screen to draw the Gizmo or line. In the case of most gizmos there are line materials that are dotted or fully colored. That is how Unity gets dashed selections and pure color selections.

The line material is set to the 0 pass of the Matrix and it's _ZWrite property for the material is set to 0 to make any depth overriding turned off with back face culling turned off. This let's the gizmo or selection line to appear in front of any objects even in scene view.

So every Gizmo call we do for debugging, every single line drawn in the sprite editor, bone editor, and so forth is literally a shader being applied to a material and that material is used to draw a pixel line by calling the GPU Command Buffer directly.......Ihate it, but got to admit once you understand shader code it is actually super easy to edit.

With that knowledge you can actually write your own custom outline render for gizmos by passing in a new shader to the Gizmo Line Material.

bronze coyote
#

huh that is really neat!

hoary ridge
#

Oh so i had a long message typed out and it involved an invite link to the SF community package request discord.....apparently Dino bot actually blocks invite links for security reasons which is good, but it delted my entire response and summary of stuff oof.

#

@bronze coyote Was going to ask if you wanted a link to the SF Community Unity package Discord.
This is a Discord we have Codecks set up so people can make feature requests, report bugs, and ask for demos of certain helper functions.
I apparently can't send a Discord invite link in Unity's Discord because of Dino bot though sadly.

Not sure how you feel about me sending you a DM with the invite link, because I know some people don't accept Discord invites for security reasons.

#

Basically we made a website, a public task tracking system for the community, and a bit more to help the community out.
It was the reason everything seemed to take a lot longer.

#

Here is an example of the feature request system.

There are text channels in the server now where you can type a command in Discord text chat like the following.
/sf-utilities-request

And it will call a mini Discord window up that allows you to put in information for your feature requests.
Then the feature request is added to our studios public community task board for people to discuss, vote up, and it allows us to assign a dev to help with that feature.

#

Also when it is submitted it goes to this link for anyone to see the discussions on it. This allows people to easily request new features big or small, give feedback, and report bugs.
Due note I will be adding more decks today for all sf community packages. Here is the list of free tools we are releasing.

  1. Metroidvania Toolkit
  2. Sprite Editor Rework
  3. Tile Map Rework
  4. Core Utilities - Some packages will auto import this one because they use some of it to speed of it's development.
  5. SF UIElements - A set of tools for creating anything with UI Toolkit. Most packages with custom editors rely on this for easier Editor Tool creation.

Core Utilities and SF UIElements are the bulk of all systems honestly.

https://open.codecks.io/shatter-fantasy-unity-packages

bronze coyote
#

I'll definietly check out the website

hoary ridge
#

Due note we are creating the decks today for the feature requests and bug reporting. Some already exist.
For reference if you haven't ever used Codecks a Desk is a category to organize tasks that are related to each other or in the same set of tools.

bronze coyote
#

yeah i have never used one of these before even professionally

hoary ridge
#

We set this one up specifically as a place for people to view current requests and discuss which ones are more important.
I can invite you to the Discord it you want. It is where the devs are for my studio and it will be where we start taking community requests discussing things.
We will also focus on helping people there if they have questions about game dev or programming.

Basically it is a small Discord community we created recently to start helping people. Due note we already added some spam protection, security checks, and permissions to help prevent any time a troll wants to mess with the community.
One reason it took longer to mention it was we wanted to figure things out before inviting people to make sure we can get ahead of any trolling or spamming.

bronze coyote
#

sure why not, you can send me a link and i'll join

#

I don't mind suggesting new ideads

#

also having outlets to ask people stuff is always n ice

hoary ridge
#

Alright going to send you a friend invite and the server invite in a DM. And the group there will be getting actively starting the second half of the week in the text chat at least.

Some of them are at a competition for a game jam that the university they went to was holding.

#

Okay yeah, I had to send you a friend request. Discord blocking invites to server to non-friends. Which honestly I am glad it does to prevent spamming and security issues.

bronze coyote
#

yeah it helps

#

sometimes they make good features

#

btw how has the tile overlay showing thingy been going

#

aware you having you know, been doing a ton else in the meantime but I was curious

hoary ridge
#

So that is a part of the SF Utilities package that is going to be downloadable. Actual the next step on my list today is adding the commits to the like branch for it.

I had it on a private branch and doing some testing to push it to the public branch. Going to be honest I was having to research into Git Hub Actions, branching permissions, and a few more.
The goal is to make sure everything is secure. We have a public repo up already, but I am needing to push the commits live.

Link below for the Shatter Fantasy Git Hub. I only have the SF Utilities package public right now. Today is when I push the others.
Due note it is not updated yet. We had to standardize the package JSON settings to make everything work.
That is what I am working on after I finish my lunch today.

https://github.com/Shatter-Fantasy

GitHub

Shatter Fantasy has one repository available. Follow their code on GitHub.

#

I will be streaming the process of releasing stuff and doing studio set up basically after lunch.
Our team is wanting to do streams to be able to talk with the community and be able to take request live or help things live.

#

Also just for reference if you are curious about the drawing outlines or anything like that I am setting up a guide to show people how to set their own custom materials for the lines and showing how it works.

There is a file called GL Utilities. GL standing for Graphics Library. It has a copy of what originally was Unity internal GL commands that devs wasn't originally able to use with some tweaks.
There will be some functions called Draw some shape. The Draw Marquee function was the originally way Unity drew selections line for things on TileMaps.

This one we added a couple more overloads to allow passing in a set of Tile Coordinates and size of the tiles. This one will allow you to draw the lines based on the tiles you pass in and correctly do the shape for
HexGrid, RectangularGrid, and so forth

bronze coyote
#

very cool

#

I assume the utilities isnt ready yet to import though

hoary ridge
#

We are pushing naming changes to the JSON file. After that it can be go ahead and downloaded via Unity's Package Manager.
We are committing small pieces at a time for the public because we want to make sure we didn't misss any symbol definitions or assembly properties.

Example stripping out editor code for editor only stuff.

That is the first thing I am doing on stream which should start in about 45 minutes.

#

So should be ready in about less than an hour.

#

And do note this is the first attempt at doing a public repo system that can be connected with Unity. So I do apologize if we rename any of the namespaces.

We tried to standarized the naming to help prevent breaking at the start. Another reason that we took quite long.

#

Also we have a forum place created for people wanting to share game dev logs for anything they are working on. This is to help start allowing people to grow their audience when the server gets more people.

bronze coyote
#

very dope ๐Ÿ˜„ ๐Ÿ‘

hoary ridge
#

And we are also taking request for tutorials to be made for the Studio channel.

We got some tutorials being worked on to teach things like Pattern Matching, SOLID, Bit Wise Operators, and a bit more.
Basically we are aiming to be a team that exists to just help the community.

bronze coyote
#

thats cool

#

very noble goal

hoary ridge
#

If you ever want to make a request just like how we have the feature requests system for features there is a text channel called SF Tutorials Requests that allows for using a Discord command to make a request for eithe a YouTube video or a page on the Game Dev Tutorial website.

bronze coyote
#

I'll happily make suggestions if I ever find something unity can't do again lol

#

still shocked there isn't A solution to this

hoary ridge
#

Well technically there is......Unity just has the function marked Internal in C# wastelands so no one can use it.
The package I am doing exposes some of the internal functions so people can use it while adding new overloads.....because boy the overloads for the current tile outlining sucks.

bronze coyote
#

oh really lol? Is there a way to access them? I am just now curious to see them. Curious if documentation exists

hoary ridge
#

So their internal marked classes are cut out of public documentation. This made it fun to figure out where everything was behind the scene.
You can search the name of the script in an IDE if you know the name.....

So you can see stuff like that. I can demo it off in a couple minutes.

bronze coyote
#

ah on stream?

hoary ridge
#

Yeah, I can do recording and send them in a small video as well. Probably going to add small videos to the Graphics Library documentation.