Reputation: 919
I am creating a custom component and I need to add a font asset to the component like 3D text or UI text in Unity.I want similar functionality to unity default text. Like you can browse a font asset etc. I just dont know how to add this font asset option in custom inspector. I need to run this application on Android.
Upvotes: 0
Views: 395
Reputation: 126
It's quite easy to do so. Just create a variable of type Font and its done. Following script will just work fine:
using UnityEngine;
using System.Collections;
public class CustomComponent : MonoBehaviour {
//[SerializeField]Font Font;
public Font font;
}
Any of the above line will work just fine. The commented line is preferred when you don't want to make the variable public but wants to get it from the editor. Let me know if you have any further queries.
Upvotes: 3