I tried googling this, but it started to get a bit complicated. I was thinking there might be a very simple way to do this that I am just missing.
The goal is to have “GameObject2” be transparent, mask all gameobjects on a particular layer (Characters, or what would be “GameObject1”), but not mask all layers (obviously it doesn’t mask the “Money” gameobject).
Anything I could simply buy from the asset store is also acceptable, to save myself time from having to do this myself, if it’s too complicated to do quickly.
I am not entirely sure what you mean? I need to be able to move around GameObject2, and anywhere it goes it should mask GameObject1. In effect, I need to use GameObject2 to “hide” pixels, but just specific sprites or layers (not the background, which is just a different sprite on a different layer).
Alright, I believe the answer lies somewhere in shaderlab : Stencil.
I was reading about the stencil effect from this answer by supernat :
However, I just read that “Masking was made super easy” in the new GUI 4.6, which I have.
Both seem to work well for the OPPOSITE of what I’m looking for. All of these would allow GameObject2 to only be shown when it hovers over GameObject1. What I need is for GameObject1 to be masked when GameObject2 hovers over it.
One alternative hacky solution I already have, which is so far the easiest, is to use the stencil effect, but and just gameobjects to be placed everywhere EXCEPT where I want it to mask. (It’s a pretty bad way to do it, but unless I can figure out an easier way, I might stick with this until later.)
edit: Nevermind, this wont work either, because I can’t go full transparency.
Looks like there is no easy solution. I really don’t want to have to learn shader lab though >.< So much valuable dev time.
I mean that you make a material (which is the same shape as your object 2) on object 1 which acts as a mask for the texture on object one. With materials, you can specify the the offset, so this could move in the same way as your object two is doing.
Think of it as kind of a shadow passing over your game object 1 and changing it’s color.
What did you use in the end? I’m trying to achieve something similar as well. I really loved the “Stencil” thing. I’m checking it out now and see if I can work with that. I’d like to know what did you use?
Sorry, I have absolutely no idea what I ended up doing. My memory is not very good anymore, especially on technical stuff I haven’t messed with for a very long time.
I honestly don’t even remember what I needed this for. I assume it was for Away Mission & not my current project… lol…
Oh yea, I think I remember now. I was using it for a prototype of a mini-game for a specific profession to scan an area for hidden objects. (The player, like in Papers Please, would use a scientific device from the Medical Officer to scan for Micro-Organisms, using their Mouse/Finger)
I don’t know if I got this working or not. I know I came close if I didn’t, but either way I am at a complete memory loss. And the project is buried, so I can’t easily dig it up. I wouldn’t even remember what folders to check into without taking some time to remember everything & get back up to speed.
Whatever I ended up doing, I think I had some issues with it still. I believe I had to just move on without a satisfactory solution. It was working, but had some annoyance.
In my current project, I didn’t even remember I did this with Away Mission, so I started from scratch. Before doing anything myself, I just browsed the asset store & immediately purchased this:
SEE-THROUGH SYSTEM
It was only $30, highly rated, and had multiple applications for my game, so it was a no-brainer for me. The time it would take me to dig through how to do this & implement it is certainly worth far more than a meager $30. I’ll just not eat out one night & save the headache.
And I can use this for more than just one application, since my game is a perspective Camera with 2D Sprites in a 3D World.
Worked immediately, extremely well. Love it. Highly recommend.
@CarterG81 , I liked your post for the pragmatic and helpful advice it contains… but, on an unrelated note, was saddened to hear that Away Mission is buried. Just FYI. I hope you bring it out again someday, because I still think it was a great idea!
Thank you
No doubt, I will resume Away Mission the moment I am finished with my current project. Every day I yearn to start back up on it. I absolutely love it & really want to play it myself. There’s no way in hell I won’t finish Away Mission
It’ll just take a bit more time, hehe.
I put it on pause so I could get more experience with a different game. That way I learn from my mistakes & can make Away Mission even better. I didn’t want it to be my first game, and thus suffer from “first game” flaws. Especially when so many people wanted to play it too, but I figured pausing the project (something I don’t take lightly) is worthwhile for everyone.