1.5M ratings
277k ratings

See, that’s what the app is perfect for.

Sounds perfect Wahhhh, I don’t wanna

Unity3D C#: Two awesome classes and their source code

FloatBouncer.cs: Allows you to easily move between two values and check what the current value is, or what the percentage is.

TimeBouncer.cs: Allows you to easily use Time.deltaTime to move between two values over a period of time. You tell it when you want it move to the top or the bottom. Has plenty of events to listen for that make using it easy.

I’m using these to make things fade out over time, or appear at intervals.

unity gamedev agdg unity3d unity2d indiedev

Unity3D Singletons and Transient GameObjects (One per game/One per scene) and how I’m doing it

Check out my reddit post here and throw me an upvote!

https://www.reddit.com/r/Unity3D/comments/6rh5ak/an_approach_to_singleton_and_transient_classes/

I’ve done similar things in the past and I’m sure many others have as well, but I wanted to share an approach I’m taking so far for a multiple level based VR game.

Basically I have something that looks like this in each of my scenes. 

image

When it starts, the Singleton is marked to not be destroyed.

The Game.cs is where I access my references from, which is created each time a scene is. I keep references in there to the GameSingleton references for convenience. If I want an object that will only be created 1 time in my game, I add it to the Awake method in GameSingleton. If I want something created each time a scene starts, I add it to Game.

Check it out (scripts here)

* Game.cs
* GameSingleton.cs
* LevelManager.cs
* ScreenEffects.cs
* VirtualReality.cs

It uses More Effective Coroutines [FREE] as well as VRTK. If you want to get these scripts running but don’t want MEC[F], then you should be able to refactor those out with some effort.

Unity3d gamedev agdg videogame indiedev madewithunity game dev video games unity unity2d

Unity3D Asset Update: Improved GUI interaction and rotation smoothing

Unity3D Asset - Third Person Camera(s)

I’ve updated my Unity3D asset, Third Person Camera(s) to have better GUI interaction when using the cursor and to have rotation smoothing on input values. Both are easy to setup and adjust by going to the Input component on any controller and the GUI interaction portions of any controller.

image
unity unity3d unity2d gamedev agdg indiedev madewithunity video games camera camera controller THIRD PERSON CAMERA indie game

Unity Networking - “NetworkExtensions” and making it easier to deal with

I’m working on an asset to help make Unity network all around easier for the common man. Here’s a preview of some of the static functions I’ve made to help with that.

image

Generic object types

In this picture you’ll notice generic object types that can be passed. The generic types have to extend Unity’s MessageBase class (T : MessageBase in enforced, but the collapsing is hiding it). To use those generic functions, you need to map the class Type to a MsgType short in an abstract dictionary you are required to implement (though you can leave it empty or NotImplementedException if you don’t intend to use those functions). The advantage is that you could say what MsgType a class refers to and then not have to say what type you are sending every time you call the method.

Channel Id mappings and overrides

You’ll also notice “channelIdOverride = -1″. If you set this to a 0 or greater value, it will override the default channel it sends the message on. Just like with the generic type function, there are abstract dictionary<short, int>s where you can specify what MsgType you want to map to what channel. If you don’t provide an override and you also don’t have an entry in the dictionary, it defaults to channel 0 which is the default reliable channel. That is also Unity’s default functionality as well.

Things this asset has that are not default

So far the big win here is an easy to use implementation of Client -> Client and Client -> All Clients. Unity doesn’t offer that by default since all messages need to go through the server with UNet. They still do in my implementation, but behind the scenes I’ve rerouted those messages from the server to where you want them to go in an easy way.

I also provide a unique and easily accessible Player Id for all players. This can be used to send people messages (as you can see here you need a player id to send to specific players) or to disconnect individual players.

Things to come

Easy to use object spawning, including being able to request objects to spawn from a client. By default, only the server can spawn objects.

Comments?

agdg unity unity3d gamedev indiedev video games madewithunity unity2d unet networking unity networking unity asset

UNet Unity Networking - Making it easy

Decided to come up with a simple approach to dealing with networking.

What I want:

I want to be able to send messages to all clients from any client in a static manner from anywhere anytime

What I came up with:

image

Probably wanna open that in another tab. Note: NetworkHub is my class I’m extending

Basically it consists of a Networking behaviour that:

* A class behaviour that you can spawn 1 of for a player over the network using Unity’s UNet
* To use it, just extend the base and setup the abstract methods
* Gives every player a unique integer ID to identify you by
* Gives you a single point to send networking messages to every other client. Can send anything that can be written as a byte[].
* OnPlayerConnected/Disconnected that every client can use (normally only the server gets those events)
* You can still use UNet however you want, this just gives you an additional thing you can use

The usage for me is “Send a message, it gets routed based off an ‘type’ to a handler that processes it. This way you could have say a ‘debug handler’ and a ‘play sound handler’ which could do whatever they wanted independently.” It’s generic enough with interfaces though that you can be it less complex than that.

Still have some more stuff to add and optimize, but I’ll likely put this on the Asset Store for a few dollars.

Comments?

unity unity3d unity networking unet unet networking networking agdg video games indiedev gamedev video game networking game networking madewithunity

Combining Meshes in Unity3D for Performance

Here’s an example of a really lowtech mesh combine.

Note: I do not advocate using this in production. There are way more advanced solutions out there. That said, better something than nothing.

image

Here is the performance of some rooms being rendered using combined meshes and individual blocks.

I generated 100x100 rooms and tried to look at them (which took forever to load). After a few moments with the combined rooms, it levels out to what you see there. The individual blocks remained at 3~ FPS.

The room has like 3-5 textures in it or something. This isn’t meant to be an in depth performance analysis. I just wanna show how extreme the difference is.

Edit: Someone pointed out the texture issue in the pic. I fixed it and tested again, and the same performance was seen. Didn’t take pics tho.

agdg unity3d madewithunity unity gamedev

Testing the scale of the environment. Trying to get the feel right so no where feels too massive or too small. Don’t want claustrophobia. Using my Third Person Camera(s) asset which I’ll be updating soon with a few improvements based on my recent testing. Also using a crummy character controller I whipped together quickly. I have a better one lying around somewhere, but I gotta find it.

agdg unity madewithunity gamedev indiedev unity3d

Protected Variables - Unity anti-cheat asset I made

I just finished this asset and got it posted

Check it out here

What is it?

This asset lets you add some protection to your game to prevent memory manipulation, like you can do with Cheat Engine or other software. So if you are afraid of users editing their scores to be higher, this can help prevent that.

Here are some videos

Are there alternatives on the Asset Store to this?

Yes, and they are more expensive. That’s why I made this. Other options cost like 30$ and they all do the exact same thing with the same performance anyway since there’s really only so many ways to protect your memory from being manipulated.

I’ve decided to build the parts I wanted for my game. That is, protecting memory from cheating, protecting against speed hacking, and protecting playerprefs and extending it.

Here’s another video of speed hacking being detected

And here is PlayerPrefs being extended

Any questions, comments, thoughts?

unity unity3d madewithunity gamedev agdg indiedev networking network unet videogames cheat cheat engine cheatengine unity asset unity asset store unityasset alternative work

Event System X

Check out the Asset here!

An Event System for Unity3D that does a lot of heavy lifting for you. Has both simple and complex functionality that can give you a lot of control when needed over how events are fired.

It also fires events automatically for you, which is a feature that other Event Systems do not have. Events can be normal manually broadcasted Events, or be more advanced automatically triggered Events.

Here’s a video going over a minigame made using it

Check out the Reddit post here!

Comments or questions?

unity unity3d unity2d gamedev agdg video games indiedev alternative work

Unity3D Asset Update: Smart Follow for Third Person Camera(s) ‘like in world of warcraft’

Unity3D Asset - Third Person Camera(s)

I’ve updated the Unity3D asset, Third Person Camera(s) to have a simple to use implementation of Smart Follow from World of Warcraft on the Basic Camera Controller.

You can see me demoing off some features here. I forgot to demo the “Only rotate when mouse locked” feature in this video.

Comments?

unity unity2d unity3d agdg gamedev indiedev indiegame indie game dev camera controller third person camera alternate work

Event System X - Automatic Dispatcher and Input Mapper

Check this out

https://www.assetstore.unity3d.com/#!/content/77432

An Event System for Unity3D that allows you to create events that are automatically triggered based on conditions.

Documentation here, includes code for all 15 example scenes.

I’ll be doing an extensive right up about it later on, for now, enjoy the videos

The basics:

Input Remapping:

Comments?

unity3d unity2d unity gamedev unitydev indiedev alternate work video games agdg