Unity3d Silhouette Highlight for 2d sprite - unity3d

I want to implement Silhouette Highlight on MouseOver like in this picture:
Built in Unity3d user interface elements have a component called Outline and Shadow, but they only work with the user interface, not with the SpriteRenderer. The first idea was to create a second sprite with highlight at background and enable it to MouseOver, but I think that this method is not good.

As Everts (and me) mentions in a comment,
there's nothing wrong with simply making the "glow sprites" and turning them on and off. That would certainly be done in many large games: it's good.
It's true that you could write a shader that does this, but really that would be "bad engineering" - totally unnecessary for such a simple need. (And to be clear, arguably it's plain better to make custom sprites.)
Now, this brings us to an important point about Unity engineering -
it's critical to use existing assets, in Unity work.
There are a couple of stand-out examples. Like, NatCam and Edy's vehicle system. You just - literally - cannot use the camera in a game unless you use "NatCam"; the only alternative would be to completely pointlessly spend a year building NatCam yourself.
In this case, there are many good "glow shaders" available ...
https://www.assetstore.unity3d.com/en/#!/content/20166
Enjoy!

Related

Unity Tilemap: Level-specific data on tiles in palette

I've just started my first Unity experience by moving a match-3 based game to Unity, and I want to be able to attach data to each available tile type specifying how likely that tile is to be dropped onto the board (and be able to override that value for each level). There are a few match-3 tutorials floating around, but besides a tendency to not explain how to make things happen in Unity, I haven't found any leveraging the Tilemap, which seems a shame since it looks like it provides a fair bit of necessary functionality. The only problem is, I don't see anywhere to attach data or a script to a base Tile, so I've been looking into whether going the Scriptable Tile / custom editor route would get me what I need; but then I run into the lack of instructions on how to get basic functionality on the custom editor (the ability to specify the underlying sprite seems rather fundamental, but I'm not finding anything).
Anyway, is the Scriptable Tile interface my best bet to get level-specific data attached to individual tiles, or should I be looking for a different way to get this data on there? Or should I just ditch the Tilemap and the functionality it does include out of the box altogether like all the tutorials seem to be doing?

How to create a Flashlight in unreal that can be used in Android?

The player carries the flashlight so it is moving all the time. I'm aware of using a spotlight to make a flashlight when developing for the PC but it doesn't work for android. I have tried searching about it and all i have come across is creating a dynamic material that's applied to a certain area to give the illusion of a flashlight and it doesn't look good at all. So i would like to know if there is any other way to achieve this.
I think one option would be to use post processing. I am not sure is this better than using materials, but it is different (perhaps easier) way.
Here is example that I made quickly (obviously you would need to fine tune it):
fake light GIF
This contains ambient light and post processing effect.
Yellow area in middle that you see as light is not point light, it is just effect.
It is possible to change "light" area/intensity/color/... as well as overall darkness.
Also, worth mentioning, I made this quickly since I had already somewhat similar post processing effect, I just adjusted it so it look like flashlight.
You can find more information here:
Post Process Effects
Post Process Materials

Should I change draw order?

I'm creating mobile racing(in space) game and it's first person so there is always big cockpit occluding big part of scene. Can I somehow use the fact that I know it to optimize rendering? I have heard that draw call order can be changed, but I don't know how exactly it would work.
The thing you are looking for is called "Occlusion Culling". Here is a guide from the Unity manual explaining how it works and how to set it up.
NOTE: This only culls static objects, if your cockpit moves with the player objects covered by the cockpit will not be culled by using this method. If you want to do occlusion culling with dynamic objects you need to get a 3rd party asset from the store like InstantOC, it even has a "Mobile Aircraft Controls" prefab (Note, I have never used InstantOC but I have heard good things about it).

what element i need to use to build game like this

i am building a game which is similar to the Plain Jane Flash Game for the iPad. I have decided to use cocos2d for the same, while exploring the cocos2d there are lots of option i am having. i am confuse in which elements/controls would be best for this type of game Please guide me or share any link/tutorial on cocos2d which have similar user interface.
I mean shall i use CCMenu/CCmenuItem or there is another control which is more suitable...
shall i use Sprite or simple image would be sufficent as i do not need to move anything in it.
Thanks
Although your question was not very clear, I assume your referring to the functionality of dragging and dropping different clothing items onto the game avatars. A custom CCSprite object would be much more appropriate for doing that.
However, there is not an easy answer for what you are asking. Creating a game like "Plane Jane" will involve many problems that I'm sure have not crossed your mind. I recommend you complete a few Cocos2d-iPhone tutorials before you go any further. Once you do that, you will have a much better understanding of the functionality you will need to create your game.
Here is a nice tutorial for starters:
http://www.cocos2d-iphone.org/archives/582

Collision detection with images on the iPhone using OpenGL

I'm working on a 2D game (kind of like a top down space shooter) for the iPhone using an engine very similar to cocos2d (not exactly though) on OpenGL ES. I'm trying to figure out how I'm going to do collision detection.
All the ships for my game are images, and the game will load the image as a texture onto the screen. I've got very very simple detection going already that basically just takes the rectangles of the images and checks to see if those collide and can do that just fine.
But, of course the ship isn't perfectly taking up the entire rectangle so there is whitespace in there. So my question is how am I supposed to account for that whitespace? Do I have to have the matrices of the ships stored? Or is there another way? I've also heard of possibly using the Chipmunk physics engine for collision detection? How would that work?
(1) regarding Chipmunk, the short answer is yes you should immediately download chipmunk, donate something to the bloke, and start learning about it.
Working with that for a day or so will basically answer all the questions you have. If you want to work with physics games you're going to need to get in to it.
(2) you ask about using an approximation ("just" a rectangle) instead of something more accurately shaped like your spaceships. In fact, you'll be perhaps amazed to learn, that is precisely how it is usually done in all your famous big-name games you've played since we were all kids! Indeed sometimes you might use little more than A DOT (!) to detect collisions.
What you'd probably do in production is try a more complicated model, and play with it for a few hours and see, is it actually any better to play with than your simple dot or rectangle model.
If you do want to make a more complicated model -- just make one! Build it up from three or four rectangles using your current system. Try them "all against each other", and have "one big one to check first" to see if it is even anywhere near each other (sort of a simple spatial hashing).
You will find that when you do it with Chipmunk, which as you now know you have to immediately begin after reading this message, you just build it up the same tedious way. It's not a magic bullet. But if you were going to use a "more complicated model" yes it is better to go with something standard, chipmunk, to do the work in - it will get done quicker and better. There is heaps to learn and you should hop to it!
(3) Unity is not just for 3D Finally if you want to do it the smart-ass grown up way, you'd have to use Unity3D which will let you access the very metal, the Nvidia physics on the chipset. Note that unity works perfectly for 2D games also - you just click one button in unity to use a 2D projection (many brand-name ifone 2D games are done exactly like that).
If you use that approach, you can (if you want) have "absolutely exact" physics, with every nook and cranny of your model modelled.
What is the downside to doing this? Ah hah ... well the thing is, you need superb actual 3D models of all the stuff in your game! (Like you see them building in the "how we made the movie" special features that come with your favourite Pixar blu-ray.) To do that you need things like autodesk, maya and the like. you would quite likely buy some models ready-made from a digital prop shop (no need to build "a chair" as it has been done 1000 times already and you can buy one for ten dollars).
(Unity3D is completely free to use for a few months while you see if it can make you money.)
Incidentally on the Chipmunk front --- you can just use Corona which is ridiculously easy to use and has chipmunk-like physics completely built in with zero effort on your part! You could have the whole game done in less time than it took to write this email. You could be selling your game already and thinking up the next one. Or, you could use "Cocos" which indeed has a chipmunk-like physics library built-in .. personally (just me) I do not like and won't touch cocos - but of course many games use it.
(It seems pointless, to me, using cocos which is a "for idiots" product, when you can just go ahead and use Corona, which is a "for idiots" product but stupendously easier to use, 1000x more solid, and probably literally 10x faster to finish your product and start making money.)
Noel Summary:
So in some sense using Unity3D (and hence, the actual nvidia physics on your computer's chips) is the ultimate solution if you want detailed nook-and-cranny collisions. Going down one step, Chipmunk is exactly, precisely what you should be using on the ifone/ipad for 2D physics -- it is precisely what is used in all the famous games we know so well. You have a bit of learning to do so hop to it - it's superfun. Finally go right ahead and just make your current model more complicated if you wish - roll your own by adding more rectangles!
And the fourth point is, be sure to remember that in games, astonishingly, you can often get away with remarkably simple physics (often SIMPLER!! than one rectangle - just a damn point - ie, simply measuring the distance between centers!) Fifthly after going to all the effort of testing more detailed physics, you would play test one against each other, and find out what is the simplest physics you can get away with.