This little trick is from something that I worked on that involved robots. So I added the Robot from Infinite Warfare (a game which I have, but need to actually finish… like all my other games!). Essentially there was a character that moved around an environment and attacked enemies. The problem was he sometimes got obscured by the environment. As it was a prototype, I made the quickest and dirtiest thing I could and whacked it in.
As the diagram shows above I raycasted from the camer to the player character. If the raycast hits anything marked “Obstacle” or equivalent term the object is deactivated.
This is SUPPPEEERRR basic. There are some cleverer things you can do like do a box cast and seeing how much an object is inside the box cast and fade it out, but if you need to get somehting up and running quickly then this is a quick and dirty implementation.
It is common knowledge that I work on mobile games and of course Android is one of the platforms we develop on. And from time to time we need to break point our code whilst it is running on device. Today however, I couldn’t remember how you do it. So I headed over to the Unity Manual, but there was lack of information how to do this in Visual Studio. It tells you how to easily attach to the MonoDevelop debugger, but not the Visual Studio one. So we went looking for a way to do it. Unity Answers post does tell you how to do it, but it isn’t particularly well worded and also starts of with “I just went back to MonoDevelop” which quickly makes you stop reading the rest of his/her answer.
This is how you do it.
First follow the steps on this page of the manual:
Then in Visual Studio go to the following menu:
In the next Window you should see “Android Player” (you don’t see it in the next image because I am not currently working in an Android project, but hopefully the giant arrow will help).
If you have an IP of a device you can also input it here. This also works for some of the other platforms including some of the consoles.
Unity did a nice post recently on Recore’s animation system with the layered state machine, which reminded me of something cool I have done in games before and something cool I am doing int my personal projects.
Before we get started you should read up on:
Awesome, OK here is the scenario. Say you want are making a JRPG like I am Setsuna (pictured above) and say for each ability you want the character toperforma a different character animation. Not one per character, a different character animation per ability. It would be pretty mental to set up a layer per ability they can use. Also what if you were making one of those fancy games-as-a-service and wanted to add cool abilities later on without doing a binary update. Here is one approach.
Firstly I have created this basic state machine for the characters (notice there are no transitions)
And I have created the corresponding override controller that has the default clip in the use ability slot
We are going to override this in code using the following utility function:
Now if you run the animator controller and the name of the state, and the clip you want the Use Ability state to play into this function, Unity will play the clip you loaded in!