Skip to content

Instantly share code, notes, and snippets.

@AngryAnt
Created November 8, 2012 09:19
Show Gist options
  • Save AngryAnt/4037710 to your computer and use it in GitHub Desktop.
Save AngryAnt/4037710 to your computer and use it in GitHub Desktop.
Utility editor script for displaying a dialog message when it is imported. Useful for adding messages to asset store packages for instance. Rather than just showing a dialogue, this could also be used as a platform for running an actual package installer
using UnityEngine;
using UnityEditor;
[InitializeOnLoad]
public class PackageInfo
{
const string kTitle = "Notice", kMessage = "This package is the prettiest of them all.", kButton = "Ok", kPackageIdentifier = "AwesomePackage";
static PackageInfo ()
{
if (!InfoShown)
{
InfoShown = true;
EditorUtility.DisplayDialog (kTitle, kMessage, kButton);
}
}
static bool InfoShown
{
get
{
return EditorPrefs.GetInt ("PackageInfo-" + kPackageIdentifier + "-InfoShown", 0) != 0;
}
set
{
EditorPrefs.SetInt ("PackageInfo-" + kPackageIdentifier + "-InfoShown", value ? 1 : 0);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment