Mar 21, 2018

Where is Unity Log Files?

Log Files

There might be times during development when you need to obtain information from the logs of the standalone player you’ve built, the target device, or the Editor. Usually you need to see these files when you have experienced a problem, to find out exactly where the problem occurred.
On macOS, the player and Editor logs can be accessed uniformly through the standard Console.app utility.
On Windows, the Editor logs are placed in folders which are not shown in the Windows Explorer by default. See below.

Editor

To view the Editor log, select Open Editor Log in Unity’s Console window.









On macOS, all the logs can be accessed uniformly through the standard Console.app utility.
On Windows, the Editor log file is stored in the local application data folder \Unity\Editor\Editor.log, where is defined by CSIDL_LOCAL_APPDATA.

Player


Note that on Windows and Linux standalones, the location of the log file can be changed (or logging suppressed). See documenttion on Command line arguments for further details.

iOS

Access the device log in XCode via the GDB console or the Organizer Console. The latter is useful for getting crashlogs when your application was not running through the XCode debugger.
The Troubleshooting and Reporting crash bugs guides may be useful for you.

Android

Access the device log using the logcat console. Use the adb application found in Android SDK/platform-tools directory with a trailing logcat parameter:

$ adb logcat

Another way to inspect the LogCat is to use the Dalvik Debug Monitor Server (DDMS). DDMS can be started either from Eclipse or from inside the Android SDK/tools. DDMS also provides a number of other debug related tools.

Universal Windows Platform

 


WebGL

On WebGL, log output is written to the browser’s JavaScript console.

Accessing log files on Windows

On Windows, the log files are stored in locations that are hidden by default. In Windows XP, make hidden folders visible in Windows Explorer using Tools > Folder Options… > View (tab).
On Windows Vista/7, make the AppData folder visible in Windows Explorer using Tools > Folder Options… > View (tab). The Tools menu is hidden by default; press the Alt key once to display it.

Reference:  https://docs.unity3d.com/Manual/LogFiles.html

How to Save and Load a Game in Unity

Games are getting longer and longer, with some having over 100 hours of content. It would be impossible to expect players be able to complete all of what a game has to offer in just one sitting. That’s why letting the player save their game is one of the most essential features your game should have — even if it’s just to keep track of their high scores.
But how does one create a save file and what should be in it? Do you need to use a save file to keep track of player settings too? What about submitting saves to the web so they can be downloaded later on a different device?
In this tutorial you will learn:
  • What serialization and deserialization are.
  • What PlayerPrefs is and how to use it to save player settings.
  • How to create a save game file and save it to disk.
  • How to load a save game file.
  • What JSON is and how you would use it.
It is assumed that you have some basic working knowledge of how Unity works (such as being able to create and open scripts), but other than that everything has been prepared so this tutorial will be very easy to follow. Even if you are new to C#, you should have no trouble keeping up except for a few concepts that might require further reading.
Note: If you are new to Unity or looking to pick up more Unity skills, you should checkout out our other Unity tutorials where you can learn about lots of Unity topics from C# to how the UI works.

Getting Started

Download the starter project here. You will be implementing the code for saving and loading the game, as well as the logic for saving the players settings.

Important Save Concepts

There are four key concepts to saving in Unity:
PlayerPrefs: This is a special caching system to keep track of simple settings for the player between game sessions. Many new programmers make the mistake of thinking they can use this as a save game system as well, but it is bad practice to do so. This should only be used for keeping track of simple things like graphics, sound settings, login info, or other basic user-related data.
Serialization: This is the magic that makes Unity work. Serialization is the conversion of an object into a stream of bytes. That might seem vague but take a quick look at this graphic:
Serialization illustration
What is an “object”? In this case an “object” is any script or file in Unity. In fact, whenever you create a MonoBehaviour script, Unity uses serialization & deserialization to convert that file down to C++ code and then back to the C# code that you see in the inspector window. If you’ve ever added [SerializeField] to get something to appear in the inspector, you now have an idea of what’s going on.
Note: If you’re a Java or web developer, you might be familiar with a concept known as marshalling. Serialization and marshalling are loosely synonymous, but in case you’re wondering what a strict difference would be, serialization is about converting an object from one form to another (e.g. an object into bytes), whereas marshalling is about getting parameters from one place to another.
Deserialization: This is exactly what it sounds like. It’s the opposite of serialization, namely the conversion of a stream of bytes into an object.
JSON: This stands for JavaScript Object Notation, which is a convenient format for sending and receiving data that is language agnostic. For example, you might have a web server running in Java or PHP. You couldn’t just send a C# object over, but you could send a JSON representation of that object and let the server recreate a localized version of it there. You’ll learn more about this format in the last section but for now just know that this simply a way of formatting data to make it multi-platform readable (like XML). When dealing with converting to and from JSON, the terms are JSON serialization and JSON deserialization respectively.

Player Prefs

This project has been set up so that all you will focus on is the logic for saving and loading games. However, if you are curious how it all works, don’t be afraid to open all the scripts and see whats going on, and feel free to ask a question here or in the forums if you need help.
Open the project, then open the Scene named Game and then click play.
Start menu
To start a game, click the New Game button. To play the game, you simply move your mouse, and the gun will follow your movement. Click the left mouse button to fire a bullet and hit the targets (which flip up and down at various time intervals) to get points. Try it out and see how high a score you can get in 30 seconds. To bring up the menu at any time, press the escape key.
game in progress
As fun as that game was, it might have been a little dry without music. You may have noticed that there is a music toggle, but it was switched off. Click play to start a new game, but this time click the Music toggle so it’s set to “On”, and you will hear music when you start your game. Make sure your speakers are on!
music toggle
Changing the music setting was simple, but click the play button again and you’ll notice a problem: the music is no longer checked. While you did change the music setting earlier, there was nothing keeping track of that change. This is the kind of thing that PlayerPrefs excels at.
Create a new script named PlayerSettings in the Scripts folder. Since you’ll be using some UI elements, add the following line at the top of the file with the other namespaces:
using UnityEngine.UI;
Next, add the following variables:
[SerializeField]
private Toggle toggle;
[SerializeField]
private AudioSource myAudio;
These will keep track of the Toggle and AudioSource objects.
Next add the following function:
  public void Awake ()
  {
    // 1
    if (!PlayerPrefs.HasKey("music"))
    {
      PlayerPrefs.SetInt("music", 1);
      toggle.isOn = true;
      myAudio.enabled = true;
      PlayerPrefs.Save ();
    }
    // 2
    else
    {
      if (PlayerPrefs.GetInt ("music") == 0)
      {
        myAudio.enabled = false;
        toggle.isOn = false;
      }
      else
      {
        myAudio.enabled = true;
        toggle.isOn = true;
      }
    }
  }
When set up, this will:
  1. Check if the PlayerPrefs has a cached setting for the “music” key. If there is no value there, it creates a key-value pair for the music key with a value of 1. It also sets the toggle to on and enables the AudioSource. This will be run the first time the player runs the game. The value of 1 is used because you cannot store a Boolean (but you can use 0 as false and 1 as true).
  2. This checks the “music” key saved in the PlayerPrefs. If the value is set to 1, the player had music on, so it enables the music and sets the toggle to on. Otherwise, it sets the music to off and disables the toggle.
Now Save the changes to your script and return to Unity.
Add the PlayerSettings script to the Game GameObject. Then expand the UI GameObject, followed by the Menu GameObject to reveal its children. Then drag the Music GameObject on to the Toggle field of the PlayerSettings script. Next, select the Game GameObject and drag the AudioSource over to the MyAudio field.
<Connect PlayerSettings script
The music is set up to work when the game runs (since there is code in the Awake function), but you still need to add the code if the player changes the setting during gameplay. Open the PlayerSettings script and add the following function:
  public void ToggleMusic()
  {
    if (toggle.isOn)
    {
      PlayerPrefs.SetInt ("music", 1);
      myAudio.enabled = true;
    }
    else
    {
      PlayerPrefs.SetInt ("music", 0);
      myAudio.enabled = false;
    }
    PlayerPrefs.Save ();
  }
This does almost the same as the code you wrote earlier, except it has one important difference. It checks the state of the music toggle and then updates the saved setting accordingly. In order for this method to be called, and thus for it to be able to do its work, you need to set the callback method on the Toggle GameObject. Select the Music GameObject and drag the Game GameObject over the object field in the OnValueChanged section:
Connecting the callback method
Select the dropdown which currently says No Function, and select PlayerSettings -> ToggleMusic(). When the toggle button in the menu is pressed, it will call the ToggleMusic function.
Selecting the right method
Now you’ve got things set up to keep track of the music setting. Click Play and try it out by setting the music toggle to on or off, then ending the play session and starting a new play session.
The game menu
The music setting is now properly saved! Great job — but you’re only getting started with the power of serialization.

Saving The Game

Using PlayerPrefs was pretty simple wasn’t it? With it, you will be able to easily store other settings in there such as the player’s graphic settings, or login info (perhaps Facebook or Twitter tokens), and whatever other configuration settings make sense to keep track of for the player. However, PlayerPrefs is not designed to keep track of game saves. For that, you will want to use serialization.
The first step to creating a save game file is creating the save file class. Create a script named Save and remove the MonoBehaviour inheritance. Remove the default Start() and Update() methods as well.
Next, add the following variables:
public List<int> livingTargetPositions = new List<int>();
public List<int> livingTargetsTypes = new List<int>();

public int hits = 0;
public int shots = 0;
In order to save the game you will need to keep track of where existing robots are and what types they are. The two lists accomplish this. For the number of hits and shots you are just going to store those as ints.
There is one more very important bit of code you need to add. Above the class declaration, add the following line:
[System.Serializable]
This is known as an attribute and it is metadata for your code. This tells Unity that this class can be serialized, which means you can turn it into a stream of bytes and save it to a file on disk.
Note: Attributes have a wide range of uses and let you attach data to a class, method, or variable (this data is known as metadata). You can even define your own attributes to use in your code. Serialization makes use of the [SerializeField] and [System.Serializable] attributes so that it knows what to write when serializing the object. Other uses for attributes include settings for unit tests and dependency injection, which are way beyond the scope of this tutorial but well worth investigating.
The entire Save script should look like this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[System.Serializable]
public class Save
{
  public List<int> livingTargetPositions = new List<int>();
  public List<int> livingTargetsTypes = new List<int>();

  public int hits = 0;
  public int shots = 0;
}
Next, open the Game script and add the following method:
private Save CreateSaveGameObject()
{
  Save save = new Save();
  int i = 0;
  foreach (GameObject targetGameObject in targets)
  {
    Target target = targetGameObject.GetComponent();
    if (target.activeRobot != null)
    {
      save.livingTargetPositions.Add(target.position);
      save.livingTargetsTypes.Add((int)target.activeRobot.GetComponent().type);
      i++;
    }
  }

  save.hits = hits;
  save.shots = shots;

  return save;
}
This code creates an instance of the Save class you made earlier and then sets the values from the existing robots. It also saves the players shots and hits.
The Save button has been hooked up to the SaveGame method in the Game script, but there is no code in SaveGame yet. Replace the SaveGame function with the following code:
public void SaveGame()
{
  // 1
  Save save = CreateSaveGameObject();

  // 2
  BinaryFormatter bf = new BinaryFormatter();
  FileStream file = File.Create(Application.persistentDataPath + "/gamesave.save");
  bf.Serialize(file, save);
  file.Close();

  // 3
  hits = 0;
  shots = 0;
  shotsText.text = "Shots: " + shots;
  hitsText.text = "Hits: " + hits;

  ClearRobots();
  ClearBullets();
  Debug.Log("Game Saved");
}
Taking it comment-by-comment:
  1. Create a Save instance with all the data for the current session saved into it.
  2. Create a BinaryFormatter and a FileStream by passing a path for the Save instance to be saved to. It serializes the data (into bytes) and writes it to disk and closes the FileStream. There will now be a file named gamesave.save on your computer. The .save was just used as an example, and you could use any extension for the file save name.
  3. This just resets the game so that after the player saves, everything is in a default state.
To save the game, press Escape at any time during play and click the Save button. You should notice everything resets and the console output displays a note that the game has been saved.
Console output
LoadGame in the Game script is connected to the Load button. Open the Game script and locate the LoadGame function. Replace it with the following:
public void LoadGame()
{ 
  // 1
  if (File.Exists(Application.persistentDataPath + "/gamesave.save"))
  {
    ClearBullets();
    ClearRobots();
    RefreshRobots();

    // 2
    BinaryFormatter bf = new BinaryFormatter();
    FileStream file = File.Open(Application.persistentDataPath + "/gamesave.save", FileMode.Open);
    Save save = (Save)bf.Deserialize(file);
    file.Close();

    // 3
    for (int i = 0; i < save.livingTargetPositions.Count; i++)
    {
      int position = save.livingTargetPositions[i];
      Target target = targets[position].GetComponent();
      target.ActivateRobot((RobotTypes)save.livingTargetsTypes[i]);
      target.GetComponent().ResetDeathTimer();
    }

    // 4
    shotsText.text = "Shots: " + save.shots;
    hitsText.text = "Hits: " + save.hits;
    shots = save.shots;
    hits = save.hits;

    Debug.Log("Game Loaded");

    Unpause();
  }
  else
  {
    Debug.Log("No game saved!");
  }
}
Looking at this in detail:
  1. Checks to see that the save file exists. If it does, it clears the robots and the score. Otherwise it logs to the console that there is no saved game.
  2. Similar to what you did when saving the game, you again create a BinaryFormatter, only this time you are providing it with a stream of bytes to read instead of write. So you simply pass it the path to the save file. It creates the Save object and closes the FileStream.
  3. Even though you have the save information, you still need to convert that into the game state. This code loops through the saved robot positions (for living robots) and adds a robot at that position. It also sets it to the right type. For simplicity, the timers are reset, but you can remove this if you prefer. This prevents the robots from disappearing right away and gives the player a few seconds to get oriented in the world. Also, for simplicity, the animation of the robot moving up is set to finished, which is why robots partly moving up when you saved will be shown as fully up when a game is loaded.
  4. This updates the UI to have the right hits and shots set, and it sets the local variables so that when the player fires or hits a target it continues to count up on the value that was previously. If you didn’t do this step, the next time the player fires or hits a target the displayed values would get set to 1.
Click Play, play the game for a bit then save. Click the Load button and you will see it load the enemies as they were set up before when you saved the game. It also properly sets your score and the shots you’ve fired.
Game in progress

Saving Data With JSON

There’s one more trick you can use when you want to save data — and that is JSON. You could create a local JSON representation of your game save, send it to a server, then get that JSON (as a String) to another device and convert it from a string back to JSON. This tutorial won’t cover sending/receiving from the web, but it is very helpful to know how to use JSON — and it’s incredibly simple.
The format of JSON can be a little different than what you might be used from C# code, but it’s pretty straightforward. Here is a simple JSON example:
{
  "message":"hi",
  "age":22
  "items":
  [
    "Broadsword",
    "Bow"
  ]
}
The outer brackets represent the parent entity that is the JSON. If you are familiar with a Dictionary data structure, then JSON is similar. A JSON file is a mapping of key and value pairs. So the above example has 3 key-value pairs. With JSON, the keys are always strings, but the values can be objects (i.e. children JSON objects), arrays, numbers, or strings. The value set to the “message” key is “hi”, the value of the “age” key is the number 22, and the value of the “items” key is an array with two strings in it.
The JSON object itself is represented by a String type. By passing this data as a String, any language can easily re-create JSON object from the string as a constructor argument. Very convenient and very simple.
Each language has its own way of creating an object from this format. Since Unity 5.3, there exists a native method to create a JSON object from a JSON string. You will create a JSON representation of the high score of the player and then print it to the console. But you extend this logic by sending the JSON to a server.
The Game script has a method named SaveAsJSON that is hooked up to the Save As JSON button. Replace SaveAsJSON with the following code:
public void SaveAsJSON()
{
  Save save = CreateSaveGameObject();
  string json = JsonUtility.ToJson(save);

  Debug.Log("Saving as JSON: " + json);
}
This creates the Save instance like you did earlier. Then it creates a JSON string using the ToJSON method on the JsonUtility class. It then prints the output to console.
Start a game, hit a few targets, then press Escape to bring up the menu. Click the Save As JSON button, and you will see the JSON string you created:
Console output
If you want convert that JSON into a Save instance you would simply use:
Save save = JsonUtility.FromJson(json);
That is what you would do if you wanted to download a save file from the web and then load it into your game. But setting up a web server is a whole other process! For now, pat yourself on the back because you just learned a few techniques that will… save you some trouble in your next game (groan)!

Reference:  https://www.raywenderlich.com/160815/save-load-game-unity

Feb 10, 2018

Resolving harmless binding errors in WPF

While developing WPF applications, you will notice a lot of binding errors being displayed in output window; like this
System.Windows.Data Error: 4 : Cannot find source for binding with reference 
'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.DataGrid', 
AncestorLevel='1''. BindingExpression:Path=CellsPanelHorizontalOffset; DataItem=null; 
target element is 'Button' (Name=''); target property is 'Width' (type 'Double')

System.Windows.Data Error: 4 : Cannot find source for binding with reference 
'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', 
AncestorLevel='1''. BindingExpression:Path=HorizontalContentAlignment; DataItem=null; 
target element is 'ComboBoxItem' (Name=''); target property is 
'HorizontalContentAlignment' (type 'HorizontalAlignment')

System.Windows.Data Error: 4 : Cannot find source for binding with reference 
'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', 
AncestorLevel='1''. BindingExpression:Path=VerticalContentAlignment; DataItem=null; 
target element is 'ComboBoxItem' (Name=''); target property is 
'VerticalContentAlignment' (type 'VerticalAlignment')
I also faced this problem and tried a lot of things to get to the root cause of the problem. It was very frustrating as AncestorLevel is not used anywhere in code! and I was not able to find the place in code which is responsible for these errors.
Even after searching the various forums and articles there was no solution for this problem; but this was a very common issue and cause of this problem as mentioned on various forums:
This is a "known" issue, and happens to all controls that contain dynamically created lists (all item controls i.e. ComboBox, menu, ListBox etc.).
ControlTemplate of items in these controls (specifically MenuItem, ComboBoxItem etc.)
try to find the nearest ItemsControl and bind to the VerticalAlignment and HorizonalAlignment properties and raises this error on not finding the source.
Microsoft guys mention here and here that “This error has already been handled internally, so you can just leave it alone.” But, still I wanted some sort of solution so as not to have so many irritating error messages in my output window;
Solution 1:
So, I tried one of the workaround provided for this problem i.e. to explicitly set the properties which cause problems like this -
<ComboBox
    Name="control">
    <ComboBox.ItemContainerStyle>
        <Style
            TargetType="ComboBoxItem">
            <Setter
                Property="HorizontalContentAlignment"
                Value="Left" />
            <Setter
                Property="VerticalContentAlignment"
                Value="Center" />
        </Style>
    </ComboBox.ItemContainerStyle>
</ComboBox>
This works but it’s very hard task to set these properties across the whole solution for each problematic control(i.e. ListBox, Menu, ContextMenus etc.).
Have a look at this SO question for some other workarounds for this problem - ListBox with Grid as ItemsPanelTemplate produces weird binding errors
Solution 2:
Another workaround is to suppress these errors (actually, it seems more appropriate to call them warnings) by setting the data binding source switch level as critical in constructor of the class or a top level window -
#if DEBUG 
System.Diagnostics.PresentationTraceSources.DataBindingSource.Switch.Level = System.Diagnostics.SourceLevels.Critical;
#endif
I find this one line workaround more appropriate as it works for all such controls (like Menus, ListBox etc.) and that too across the whole project  -

REFERENCE : https://weblogs.asp.net/akjoshi/resolving-un-harmful-binding-errors-in-wpf

Unity Volumetric Light Error on Mac OSX

When I get build from Unity for Mac OS X and run the game on Mac OSX, I get

ERROR:

Initialize engine version: 2017.3.0f3 (a9f86dcd79df)
GfxDevice: creating device client; threaded=1
2018-02-07 12:42:57.410 btm[28692:5744936] Color LCD preferred device: Intel HD Graphics 5000 (high power)
2018-02-07 12:42:57.410 btm[28692:5744936] Metal devices available: 1
2018-02-07 12:42:57.410 btm[28692:5744936] 0: Intel HD Graphics 5000 (high power)
2018-02-07 12:42:57.411 btm[28692:5744936] Forcing user selected device: Intel HD Graphics 5000 (high power)
Initializing Metal device caps: Intel HD Graphics 5000
Begin MonoManager ReloadAssembly
- Completed reload, in  0.137 seconds
WARNING: Shader Unsupported: 'Sandbox/VolumetricLight' - Pass '' has no vertex shader
ERROR: Shader Shader is not supported on this GPU (none of subshaders/fallbacks are suitable)WARNING: Shader Unsupported: 'Sandbox/VolumetricLight' - Setting to default shader.
WARNING: Shader Unsupported: 'Hidden/BilateralBlur' - Pass '' has no vertex shader
ERROR: Shader Shader is not supported on this GPU (none of subshaders/fallbacks are suitable)WARNING: Shader Unsupported: 'Hidden/BilateralBlur' - Setting to default shader.
WARNING: Shader Unsupported: 'Hidden/VideoDecodeOSX' - Pass 'FLIP_RGBARECT_TO_RGBA' has no vertex shader
WARNING: Shader Unsupported: 'Hidden/VideoDecodeOSX' - Setting to default shader.
WARNING: Shader Unsupported: 'Hidden/BlitToDepth' - Pass '' has no vertex shader
WARNING: Shader Unsupported: 'Hidden/BlitToDepth' - Setting to default shader.
WARNING: Shader Unsupported: 'Hidden/BlitToDepth_MSAA' - Pass '' has no vertex shader
WARNING: Shader Unsupported: 'Hidden/BlitToDepth_MSAA' - Setting to default shader.
Metal RecreateSurface[0x10d626e60]: surface size 1440x900
Setting up 2 worker threads for Enlighten.
  Thread -> id: 7000014b6000 -> priority: 1
  Thread -> id: 700001539000 -> priority: 1
UnloadTime: 4.903137 ms

Trying to access pass 4, but material 'Sandbox/VolumetricLight' subshader (0) has only 1 valid passes.
UnityEngine.Material:SetPass(Int32)
VolumetricLight:SetupDirectionalLight(VolumetricLightRenderer, Matrix4x4) (at C:\Users

Invalid pass number (5) for Graphics.Blit (Material "Hidden/BilateralBlur" with 1 passes)
UnityEngine.Graphics:Internal_BlitMaterial(Texture, RenderTexture, Material, Int32, Boolean)
UnityEngine.Graphics:Blit(Texture, RenderTexture, Material, Int32) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/GraphicsBindings.gen.cs:2343)
VolumetricLightRenderer:OnRenderImage(RenderTexture, RenderTexture) (at /Users/Shared/Unity/eatallthe/Assets/Volumetric/Scripts/VolumetricLightRenderer.cs:343)

FIX:  

1- Edit > Project Settings > Player


2 - From Other Settings > Rendering, Uncheck "Auto Graphics API for Mac"

4- Re-Order as OpenGLCore appears above Metal


Jan 17, 2018

Top 5 Free Unity Assets

The Unity Asset Store is a treasure chest of awesome tools for building games. Most of the offers are paid, but did you know that there are some powerful and very useful assets released for free? Such quality solutions are not only friendly to budget-sensitive indie developers but often beat the paid offers in terms of usability. On top of all, the free Unity Assets are a great way to get started with serious Unity game development.
Here is our list of the Top 5 Best Free Assets on the Unity Store!

1. iTween – Free Unity Scripting Library.

iTween is a free and feature-rich animation system for Unity. It is one of the first assets I personally add to a new game project. It grants you access to dozens of useful functions which help you animate the exposed (i.e. public) values of any component!
iTween Unity Asset Path Example
Let’s say you want to move an object along a path. One way to do that is to create waypoints (empty gameObjects) and then use iTween to move your object from one waypoint to the next. Here is an example of how simple this is to accomplish with the tween library:
And that’s it! Your object will move reliably following the waypoints. You can explore the many uses of iTween in its detailed Documentation.

2. ProBuilder Basic – Free Unity 3D Modeling Editor Extension.

ProBuilder Basic Unity Asset Example
Build the geometry of your game levels directly in the Unity editor! Whether you need to create a quick prototype of your game, or to go deep into world-building, ProBuilder Basic is capable and easy to use.
The fact that you are working in the Unity Editor and not inside an external program means you can play-test everything instantly. A huge time-saver and an awesome asset!

3. “Unity-chan!” Model – Free Unity 3D Character Model.

Unity Chan 3D Model Asset Example
As far as characters go, the Kohaku Ootori Unity 3D model is one of the cutest and most skillfully designed on the Asset Store. Kohaki comes with 31 animations, 31 still poses, 12 Emotions making from blend shapes and beautiful textures and shaders.
You can use the cute 3D girl in your finished game or just as a nice model to look at in your prototype :).

4. Tanks! – Free Unity Sample Project – Tutorial.

Tanks Unity Asset Two Players Example
Of all Unity Tutorial projects this one is my favorite – it is a great introduction to Game Planning, Physics, Inputs and Audio Mixing. And on top of that – the completed project is a fun little game for two players.
The idea is so good, that ever since I played it, I’ve wanted to create a published spin-off :). Download it, follow along the tutorial if you are new to Unity, or just use it as inspiration for your next game!

5. Absolutely Free Music – for use in your Unity games.

The importance of game music is too often underestimated by aspiring game developers. The Audio atmosphere should not be an afterthought, as it can noticeably improve the gaming experience. A good place to start are the audio track in the Absolutely Free Music Unity Asset. The pack includes 41 compositions in various genres – from rock and instrumental, to trance and ambient. A careful selection of these tracks would definitely make a prototype or even a finished product much more impressive!

This was our collection of most useful Free Unity Assets. Grab some of these free goodies and have fun building games! 🙂

Reference: https://ironic.games/unity-asset-store-reviews/top-5-free-assets

Unity Development: MonoDevelop vs Visual Studio

If you’ve ever researched the Unity MonoDevelop vs Visual Studio controversy on the programming forums, you already know how passionate developers can be about their favorite tools. Devotional praise and heated vitriol are spilling over the keyboards 🙂 . And since a lot of the posted opinions are contradictory, a starting developer in Unity can become anxious about which code editor is the right choice.

Let me put your mind at ease: it doesn’t matter all that much which IDE (integrated development environment) you start with. Yes, yes – this notion seems strange when the overwhelming consensus online is that there must be a Highlander type of battle to the death.
However, selecting a code editor really doesn’t need to be a soul-crushing dilemma. You won’t fail as a game developer for not using Visual Studio any more than you would fail as a novelist if you shrug off Microsoft Word.
Indeed, MonoDevelop and Visual Studio have their Pros and Cons. However, there is one important part which is lost in their comparison:

Both IDE solutions are perfectly capable of creating great Unity games!

With this in mind, let’s review the two options. MonoDevelop is a C# open source IDE for Windows and macOS. It is similar to NetBeans and Microsoft Visual Studio, but it is lighter and lacks some of their features. MonoDevelop is the default editor for Unity and thus fully integrated – a fact which makes the occasional bugs additionally irritating.
On the other hand, Visual Studio is a popular solution with all the bells and whistles of a complete IDE. However, even though the software itself is free, the lavish features come at a price. The Microsoft Visual Studio Community 2015 package is huge, adding 7.6GB to the Unity installation. It also takes up a lot more resources while running, which makes it sluggish and unresponsive on weaker PC configurations.
Now let’s review the key features of both programs.

MonoDevelop vs Visual Studio Community: Pros and Cons

1. Stability: winner Visual Studio.

Here the advantage is clearly on the side of Visual Studio. It is a very stable product with a long history of handling well massive projects. On the other hand, MonoDevelop, sort of, hangs in there. That said, you probably won’t see much of a difference when working on a small indie project.

2. Resources: MonoDevelop is ahead.

MonoDevelop takes the lead. We already mentioned that Visual Studio is a resource hog. You really need a current system with 12+ GB of RAM to have it work smoothly, which could be an issue for some laptop-bound developers (who should really upgrade, yada, yada). Anyway, as expected, the nimble MonoDevelop finishes ahead of Microsoft’s colossus.

3. Features: Visual Studio, hands down.

Well, this one goes to Visual Studio. It has a ton of free and paid plugins that extend its functionality. A popular example is JetBrains ReSharper, which automates your coding routines. MonoDevelop is way, way behind in this respect. Nevertheless, if you can’t name a single external plugin you need, you should be just fine with MonoDevelop.

4. Styling: Visual Studio is looking good.

OK, so again, Visual Studio wins this category. There are many more options to style your code and tweak it to your favorite look. In this respect, MonoDevelop is no thrills, just business. Which isn’t all that bad, I have to say – if it is your first IDE.

5. Documentation – both offer plenty.

There is abundant documentation for both. In general, there are much more developers worldwide using Visual Studio, so you would find more references online for it. Still, in both cases virtually any issue you find has probably been suffered and solved by bruised older coders.

The Final Judgement

Unbelievably, both MonoDeveloper and Virtual Studio are GOOD products (whaa?). Yes, and you are a lucky developer who lives in a time when you have a choice between multiple polished, well made IDEs for Unity. I personally started out with MonoDevelop, tried Visual Studio, had some issues there, and went back to MonoDevelop (this is also allowed, fellas). So don’t sweat this decision like it is the make or break point of your game developer’s career – it isn’t. Instead focus on utilizing the features available in your IDE of choice and on writing better code – honestly, this is way, way more important.
And since both MonoDeveloper and Virtual Studio are FREE, I suggest that you try them for yourself and see which one YOU like :). Then come online and tell us all where we are wrong, because this is the Way of the Developer! 😉 Cheers!
A quick note for Mac users: while Visual Studio Community isn’t available on macOS, there are a couple of other options worth checking out: Sublime Text Editor and Visual Studio Code. They are both modest code editors and not full blown IDEs, but if you really can’t stand MonoDevelop for some reason, you can give them a shot.

Reference: https://ironic.games/coding-games/unity-development-monodevelop-vs-visual-studio

Unity Personal vs Unity Plus vs Unity Pro vs Enterprise

Should I Use a Free or Paid Unity License

Which Unity license should I get? A reasonable question. Unity comes in several varieties and depending on your goals, you will need a different license. Two questions arise most frequently:
1) Should I get a paid version (Unity Personal vs Unity Plus)?
2) Is it worth investing in a Pro version (Unity Plus vs Unity Pro)?
Let’s do an overview of each license and make a quick comparison.

Unity Personal License

The Unity Personal license is free, and as such seems the best deal of the four :). If you are completely new to Unity, starting with it is a no-brainer.
The free version is marketed as a tool for students and beginners. However, it still contains most of the features which make Unity such a great platform for game development. Most importantly, you get advantage of the full power of the Unity Game Engine. Also, with Unity Personal you can still export to all supported platforms.
The one key feature of the Unity Personal License is that it is free. You can use it as long as you make less than $100K in annual gross revenues (indeed, having more than that would be a nice problem to have). There are no royalties whatsoever.

Unity Plus License

If you plan to monetize the games you create, getting a paid Unity subscription is a must. The Unity Plus license is the most affordable one at $35 per month. Even at that relatively low price, it has several features which will make a big difference.

Unity Plus License Key Features:

  • Custom Splash Screen. It is impossible to overstate how important it is to be able to remove the default “Made with Unity” splash screen which comes with Unity Personal edition. The Unity brand itself still has a bad reputation due to the thousands of low quality games released with the free version. If you want to make games which make money, get rid of the default screen – it screams “CHEAP GAME”!
  • Performance Reporting. This additional service allows you to collects game errors in real time – from all devices and platforms. The service will alert you to bugs and bad performance immediately – quite cool! Thus you could avoid the bad reviews which inevitably come if such issues are not addressed.
Other Unity Plus features include Enhanced Analytics, Priority Queue of Cloud Build and the option to support 50 Concurrent Users in Multiplayer. In addition, you get the dark Unity Editor Skin so you can feel like a real game developer :P.

Unity Pro License

If your annual revenue or money raised is over $200K, you should look into buying a Unity Pro license. To get real value out of it, you should have good funding and work on ambitious game projects.

Unity Pro License Key Features:

  • Scalability. With Pro there is no limit on revenue. Shoot for the moon! 🙂
  • Premium support. If you need help with any Unity-related issues, you can count on the Unity support team to help you immediately.
Other Unity Pro features include Multiplayer support of 200 concurrent users, and In-game Analytics up to 50GB/mo raw data export.

Unity Enterprise License

If you have a team of over 21 people (wow, well done!), Unity can work together with you to create a custom solution. One of the benefits here is access to the Unity source. The option to modify the source would give you full control over the game performance. You can also negotiate the pricing and get volume discounts.
That said, it is unlikely that a single game developer, or even a small team would need a Unity Enterprise License. This license is suited for a big studio with a large team and deep pockets.

Unity Licenses Comparison and Advice

When starting out with Unity, by all means go with the free version. You can spend any extra funds on acquiring Unity Assets that can speed up your workflow. However, if you are serious about game development, get at least Unity Plus. It will give you the performance reporting and the custom splash screen, which you would definitely need. If you are just starting out with making games, you don’t really need Unity Pro though. You can always upgrade later, so don’t go right away for the more expensive licenses.
Check out the different licenses and decide which one is best suited for you. Treat this decision as an investment – do you plan to make money creating games? As far as investments go, for a game developer getting a paid Unity license is definitely a good one :).
View all details about the Unity licenses on the Unity website.
 
 
 Reference: https://ironic.games/coding-games/unity-personal-vs-unity-plus-vs-unity-pro-vs-enterprisehttps://ironic.games/coding-games/unity-personal-vs-unity-plus-vs-unity-pro-vs-enterprise

Best Pathfinding Tools in Unity 3D

Unity NavMesh vs Apex Path vs A* Pathfinding Project

Update June 2017: Unity 5.6 comes with improved NavMeshes! They are now component-based, allowing for multiple NavMeshes per scene. In addition, procedurally generated and dynamically loaded content is now supported – just generate the level and set the NavMesh to Bake! 😉
Hey fellow game developer, what kind of games do you want to make?
Do you dream of creating huge open worlds, full of complex and compelling characters? Do you want to give your players whole armies to engage in massive real-time battles? Or, alternatively, do you prefer to work on the fast-paced action of first person shooters?

Here Enters Unity Pathfinding

The common trait of all these genres is that your AI units need to navigate the game world. Furthermore, they need to move efficiently and with purpose. Further still, the computer controlled units should not get stuck, rotate in a circle or bump foolishly into other objects! For an immersive player experience,  it is critical for all units to “stay in character”! But how do we, as game developers, make the AI characters react and adjust to the changing game environment?
We do it by using Pathfinding. Pathfinding is the collection of tools and techniques for moving units in the game world. There are multiple ways to implement it in your game, and in this post we’ll review the 3 most popular. We’ll compare Unity’s default NavMesh solution with the two most popular pathfinding Unity assets – A* Pathfinding (available here) and Apex Path (available here).

The Built-in Unity NavMesh Agents

Unity’s default solution is the NavMesh. We can bake a Unity NavMesh from the geometry in our scene (Window -> Navigation). The baking process defines the accessible areas based on the Render Meshes of the static Game Objects. After that we can add NavMesh Agent components to our moveable characters and let them roam freely around the level:).
The built-in tools are free and straight-forward to set up. However, there are multiple issues with the Unity Navmesh. The first major problem is that the mesh is baked in advance, so it can’t be changed at runtime. In result, any shape-changing dynamic objects and obstacles won’t work correctly.
Additionally, the Unity NavMesh can’t handle procedurally generated game worlds. So, if your game depends on that feature, or even if you use levels which expand gradually, you are better off using a more capable pathfinding asset. On top of that, there are some performance issues with dynamic obstacles and massive amounts of units are present on the scene.
To sum up, Unity NavMesh works great for simple games without special pathfinding requirement. Anything beyond that, and you are much better off using a dedicated Pathfinding Unity Asset.

Pathfinding Unity Assets Comparison

As you know, the Unity Asset Store offers a treasure trove of powerful tools enhancing the Unity platform. With regard to pathfinding, two systems stand head and shoulders above the rest: A* Pathfinding Project Pro and Apex Path. Both assets are popular and battle-proven; they also integrate well with visual scripting systems like Playmaker and AI frameworks like Behavior Designer.
Both Pathfinding tools are capable and would serve you well, but they do differ in several key aspects. Let’s review their pros and cons to figure out which one is best suited for your project.

Apex Path

Apex Path is a great looking, grid-based pathfinding library. It contains a clean, well organized codebase and is packed with useful features. Let’s mentions just some of them: Load balancing, Multi-threading, Height maps, Basic Steering with local avoidance and Patrol routes. Additionally, the developers of Apex Path offer other (paid) modules like Apex Steer which extend the functionality of the asset.
Unity Pathfinding Apex Path Example dynamically generated objects

Its approach to pathfinding is grid-based, which means that you don’t need to bake anything in advance. Consequently, Apex Path is suitable for dynamically changing and procedurally generated game worlds (although larger RTS-style worlds can hit some performance issues). It also implements “portals” to allow units to travel between different navigation grids.
However, the biggest strength of Apex Path – the strictly enforced coding conventions – can sometimes become its weakness. The asset is clearly created with great care and precision, but it enforces a proprietary way of programming and makes you adapt to its rules. Just as an example, you would need to use Apex Path’s custom static methods instead of Unity’s AddComponent. At times, this level of abstraction makes the asset look a little over-engineered. Depending on the level of your programming abilities, and whether you would be OK with having to learn a different way of doing things, this may or may not be an issue for you. In any case, their support is quick and attentive, so even if you face issues with the scripting side of things, you would be in good hands.
To sum up, if you are looking for plug-and-play pathfinding solution for small maps (e.g. for FPS games), and you are ready to incorporate Apex Path in your project from the start, this is as good as it gets. However, already advanced projects, or projects which require larger maps, would generally be better served by other solutions.

A* Pathfinding Project Pro

A* Pathfinding (you can also see it as Astar or A Star Pathfinding) is the benchmark for quality pathfinding in Unity. Currently in its 4th version, Astar Pathfinding has a stellar 5 star rating on the Unity Asset Store from over 500 reviewers. It loads extremely quickly and is, frankly, easier to use than Unity’s default tool.
Unity Pathfinding A* Pathfinding Project Pro Example with platforms
The technical details are impressive. The asset supports automatic NavMesh generation and is fully multi-threaded. It offers a selection of 3 different navigation graphs (NavMesh, Grid and Point Graph), plus various types of path post-processing and local avoidance in both the XZ and XY planes. It comes with the full source code and, of course, supports dynamic updates of the graphs at runtime.
But even after this list of accomplishments, my favorite thing about A* Pathfinding is how easy it is to use. For example, a pathfinding call takes just a couple of lines of code:
And the good stuff doesn’t end there. Astar Pathfinding comes with 16 example scenes introducing its many features, so you can hit the ground running. The author of the asset, Aron Granberg, is also very active and helpful in responding to all kinds of questions about A* Pathfinding online at forum.arongranberg.com.

Conclusion

In order to handle Pathfinding in Unity correctly, you need to use the right tool. Hopefully now know you enough details to figure out whether you need to use Unity’s default NavMesh, or choose a dedicated Pathfinding asset. Good luck with the development and try to stay on the right path! 🙂
View more details about A* Pathfinding Project and Apex Path in the Unity Asset Store.

 Reference : https://ironic.games/unity-asset-store-reviews/unity-navmesh-vs-a-star-pathfinding-vs-apex-path

Jan 4, 2018

Run 2 Steam Accounts on One Computer

Need an extra DD account for storage space or want to run 2 steam games at once? Sandboxie makes it easy.

Intro

Ever play a game and wish you could have a second account for extra space, use as AFK shop or be able to trade with someone without having to leave your game? Sandboxie makes it easy.

Sandboxie allows you to run a self contained copy of steam on your computer along side your main install. Sandboxie has many other uses but I found it to be very useful when needing to run my second DD account and my other computer was otherwise engaged.

This guide is designed to help walk you through the setup and be able to use another DD account, or any other game account, on the same computer as your main account.

DISCLAIMER: This may not work for all games.

NOTE: This guide was mostly put together by another player but he didn't care to be named. Will gladly give him all the credit for this when he doesn't mind being mentioned

Requirements

  • An extra steam account (this does not allow you to run your main account twice)
  • An extra copy of the game. Family share wont work since you can play both at once. I recommend buying extra copies of your favorite game when steam has its sales or through humblebundle.

Folder Setup and Game Copy

Creating a new folder and copying the game files over is typically recommended but you can use the existing folder to save space if needed. Skip to next section if you want to use your current folder.

  • Open up your Program Files directory where your Steam installation is (eg, C:\Program Files (x86)\)
  • Create a new folder, I named mine "SteamSand" to make it simple.
  • Now go into your normal Steam folder (eg, C:\Program Files (x86)\Steam\)
  • Copy the folder "SteamApps" and file "Steam.exe" and Paste them into your SteamSand folder (eg, C:\Program Files (x86)\SteamSand\)
  • Remember to COPY&PASTE, Do not MOVE. This can take a while depending on how many games you have installed. We'll leave this alone for now and come back later. 

Sandboxie Setup

  • Now, Download SandBoxie from their website SandBoxie.com
  • Install and Run SandBoxie
  • When it's open, At the top click "Sandbox" and "Create New Sandbox"
  • Name it whatever you want, I named mine "Steam" Then Click OK
  • Once you've clicked OK, You'll see the new sandbox appear in the list, Right click on it and click "Sandbox Settings"
  • In Settings, Click the + next to "Resource Access", Then the + next to "File Access", Now click "Full Access"
  • Now click the "Add" button and Browse to the previously created "SteamSand" folder. Click on your "SteamSand" folder and Click OK.
  • Click Apply and then OK
  • There will be a popup stating you changes configuration blahblahblah, Just click OK.

How to Run

  • Now go back to that "SteamSand" folder, Right click on "Steam.exe" and click "Run Sandboxed"
  • You'll get a popup which will have you chose which Sandbox to run it with. Click on your "Steam" sandbox and click OK. (You may need to select the UAC check box as well)
  • Steam will now open and prompt you to Login. Login with whatever account you want (Most likely your 2nd account)
  • Steam will automatically download all the missing files we didn't copy.
  • Done

Note: It is best to create a shortcut on your desktop to the "Steam.exe" file in your "SteamSand" folder and name it something like "Steam - Sandbox" as you will ALWAYS have to Right click -> Run Sandboxed.

Important Notes

There are several things to know about sandboxie that many have asked about since I wrote this originally.

  • Sandboxie is free to use for 1 extra account. If you want to make 2 or more accounts using sanboxie then you must pay for it.
  • You cannot host 2 private games on the same computer. You can join your main tavern with the second account and vice versa though.
  • If running in Windowed mode, your cursor may move outside the window. I have accidentally closed my main window before when running around a map shooting. To get around this, play full screen on your main account.
REFERENCE: https://steamcommunity.com/sharedfiles/filedetails/?id=311943358


WPF Error 40 BindingExpression path error: property not found on 'object'

On XAML, I created a datatemplate with binding for an object called Skills.
And I set the datatemplate in my C# program on a ListViewItem like this:

DataTemplate template = (DataTemplate)this.FindResource("SkillListItem");
ListViewItem litem = new ListViewItem();
litem.ContentTemplate = template; 

And on visual studio I got this error:
WPF Error 40 BindingExpression path error: 'Name 'property not found on 'object' Skill

It is a strange error that can solve by changing
public string Name;
 
to this
public string Name{ get; set; }


 

Visual Studio Keyboard Shortcuts

Playing with keyboard shortcuts is very interesting and reduce the headache of using the mouse again and again while programming with visu...