Created
November 8, 2012 09:19
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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