Not able to locate the font downloaded from internet

I downloaded a font for Hindi Language (k010.ttf).
I have a menu for the game. In that I have a button (Language Change). On click of that button the fonts of language should change from English to Hindi.

I wrote this script:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class LangChng : MonoBehaviour {

//public Font myNewFont;

public GameObject go1;
public GameObject go1b1;
public GameObject go1b2;
public GameObject go1b3;
public GameObject go1b4;
public GameObject go1b5;

public GameObject go2;
public GameObject go2b1;
public GameObject go2b2;
public GameObject go2b3;
public GameObject go2b4;

public GameObject go3;
public GameObject go3b1;
public GameObject go3b2;
public GameObject go3b3;
public GameObject go3b4;
public GameObject go3b5;
public GameObject go3b6;
public GameObject go3b7;

public GameObject go4;
public GameObject go4b1;

public GameObject go5b1;
public GameObject go5b2;
public GameObject go5b3;
//public Button but;

// Use this for initialization

public void onClick ()
	go1.SetActive (true);
	//go1.SetActive (true);
	go1b1.GetComponentInChildren<Text>().text = "Vs CPU...";
	go1b2.GetComponentInChildren<Text>().text = "Vs Player...";
	go1b3.GetComponentInChildren<Text>().text = "High Score...";
	go1b4.GetComponentInChildren<Text>().text = "Options...";
	go1b5.GetComponentInChildren<Text>().text = "Exit...";

	go2.SetActive (true);
	//go1.SetActive (true);
	go2b1.GetComponentInChildren<Text>().text = "Back...";
	go2b2.GetComponentInChildren<Text>().text = "Slow...";
	go2b3.GetComponentInChildren<Text>().text = "Rock...";
	go2b4.GetComponentInChildren<Text>().text = "Pop...";

	go3.SetActive (true);
	//go1.SetActive (true);
	go3b1.GetComponentInChildren<Text>().text = "Help...";
	go3b2.GetComponentInChildren<Text>().text = "Credits...";
	go3b3.GetComponentInChildren<Text>().text = "About...";
	go3b4.GetComponentInChildren<Text>().text = "Sound...";
	go3b5.GetComponentInChildren<Text>().text = "Music...";
	go3b6.GetComponentInChildren<Text>().text = "Language...";
	go3b7.GetComponentInChildren<Text>().text = "Back...";

	go4.SetActive (true);
	//go1.SetActive (true);
	go4b1.GetComponentInChildren<Text>().text = "Back...";

	go5b1.GetComponentInChildren<Text>().text = "English...";

	go5b2.GetComponentInChildren<Text>().font = Resources.GetBuiltinResource(typeof(Font), "k010.ttf") as Font;
	//go5b2.GetComponent<Text>().font = Resources.GetBuiltinResource<Font>("k010.ttf");
	//go5b2.GetComponent<Text>().font = myNewFont;
	go5b2.GetComponentInChildren<Text>().text = "asd";

	go5b3.GetComponentInChildren<Text>().text = "Back...";


I downloaded the font file and put it in the Assets folder. However the code is not running and giving the error:

Failed to find k010.ttf
UnityEngine.Resources:GetBuiltinResource(Type, String)
LangChng:onClick() (at Assets/Scripts/LangChng.cs:83)

The resource k010.ttf could not be loaded from the resource file!
UnityEngine.Resources:GetBuiltinResource(Type, String)
LangChng:onClick() (at Assets/Scripts/LangChng.cs:83)


You are calling “Resources.GetBuiltinResource”. Two problems here

  1. “k010.ttf” is not a Unity built in resource
  2. You are calling using the “Resources” class, this requires the resource to be located in a folder named “Resource” or a sub-folder of “Resources”.

Do the following, if there is not already one there create a folder named “Resources” in the “Assets” folder. Next create a folder named “Fonts” within the “Resources” folder. Now move the “k010.ttf” font into the “Assets/Resources/Fonts” folder. Now add the following code

public Font hindFont;

void Start ()
    if (hindFont == null)
        hindFont = (Font)Resources.Load("Fonts/k010.ttf", typeof(Font));

You can either do the following once in the Start() function (more preferred) or you can do the following in the Update() function

if (hindFont != null)
    hindFont = (Font)Resources.Load("Fonts/k010.ttf", typeof(Font));
    go5b2.GetComponentInChildren<Text>().font = hindFont;