Custom Items for EZGui

This is the place to post add-on scripts you have written that use EZ GUI. Please remember only to post your add-on content and not the original EZ GUI scripts.
Forum rules
Only post your own add-on content and not any of the original EZ GUI scripts.

Custom Items for EZGui

Postby Little Angel » Wed Oct 13, 2010 12:25 am

This is a small package of tools that I'm writing to make my life with EZGui more productive.
LAsCustomItemsForEZGui-1.04.unitypackage

This package contains:
MakeGUIImage: An asset pre-processor that will scan a directory and all sub-directories for new images and import them with compatible settings for EZGui.
MakePreFab: A script that will make prefabs out of any number of GameObjects you select in your Hierarchy.
CreateUIButton: A Unity Wizard that will create a new UIButton and assign many of the basic and necessary properties.
BatchCreateUIButton: A Unity Wizard that will create any number of new UIButtons from a selection of images, create and save Prefabs of these buttons, and optionally destroy the new buttons, leaving only a palette of prefabs.

There is more detail in the read-me's in the zip file.

Image

Image

Please Note: These scripts may need some modification to work in Unity 1.7 or Unity 2.6. While I can't make them back-compatible at the moment, I can help anyone who needs to.

Please let me know if there are any problems or issues, and feel free to suggest any changes or improvements.
Little Angel
 
Posts: 772
Joined: Thu Sep 02, 2010 10:23 pm

Re: Custom Items for EZGui

Postby Little Angel » Wed Oct 13, 2010 1:02 am

I've noticed that there are two lines of code that you could easily modify that are customized for my system.

BatchCreateUIButton on Line 38:
string absolutePath = EditorUtility.SaveFolderPanel("Select Directory to Save PreFabs","/Volumes/MyHDD/MyUnityProjects/MyCurrentProject/Assets/Elements/PreFabs","");

"/Volumes/MyHDD/MyUnityProjects/MyCurrentProject/Assets/Elements/PreFabs" is the string path where the wizard will look first, if possible, when asking you to select a location to save your prefabs. This needs to be customized to your directory structure.

-

MakePreFab on Line 09:
var prefab : Object = EditorUtility.CreateEmptyPrefab ("Assets/Elements/PreFabs/Temporary/" + t.gameObject.name + ".prefab");

"Assets/Elements/PreFabs/Temporary/" is the script will attempt to save the prefabs to, and should be customized to your directory structure.
Little Angel
 
Posts: 772
Joined: Thu Sep 02, 2010 10:23 pm

Re: Custom Items for EZGui

Postby ibyte » Thu Oct 14, 2010 5:02 am

Little Angel,

I made a few mods in BatchCreateUIButton

string absolutePath = EditorUtility.SaveFolderPanel("Select Directory to Save PreFabs","",""); // This defaults to current project folder and then I just pick Assets/Prefabs
if(!string.IsNullOrEmpty(absolutePath)) ...vs (pathToCreatePerfabs)
ibyte
 
Posts: 258
Joined: Tue Sep 07, 2010 8:23 pm

Re: Custom Items for EZGui

Postby tvalleau » Tue Oct 19, 2010 1:46 am

I'm a rank newb, so perhaps this is meaningless, and I just don't understand, but when I import this package, I get these two console warning lines:

Code: Select all
Assets/Editor/G-Wiz Items/BatchCreateUIButton.cs(9,25): warning CS0649: Field `BatchCreateUIButton.spriteMaterial' is never assigned to, and will always have its default value `null'

Assets/Editor/G-Wiz Items/BatchCreateUIButton.cs(10,26): warning CS0649: Field `BatchCreateUIButton.parent' is never assigned to, and will always have its default value `null'


Should that be? Are they intentionally left to NULL?
tvalleau
 
Posts: 70
Joined: Sun Aug 15, 2010 4:55 am

Re: Custom Items for EZGui

Postby Little Angel » Tue Oct 19, 2010 8:03 am

This is the compiler being helpful and friendly! (Thanks compiler!)

What it's saying is that within the script itself there are no values assigned to those variables, which could be a problem. They are, however, intentionally left empty (null), because it's intended for you, the user, to provide a value to those two fields. This is best done by dragging the sprite material and the possible parent onto those slots when you are using the wizard window.

If these warnings annoy you, you can manually set the code to " = null;" in the script like this:
Code: Select all
   public Material spriteMaterial = null;
   public Transform parent = null;


This will tell the compiler that you have intentionally set these to "null", and that it should STFU and leave you alone.
Little Angel
 
Posts: 772
Joined: Thu Sep 02, 2010 10:23 pm

Re: Custom Items for EZGui

Postby tvalleau » Tue Oct 19, 2010 3:22 pm

Thanks, LA. I understand now.
tvalleau
 
Posts: 70
Joined: Sun Aug 15, 2010 4:55 am

Re: Custom Items for EZGui

Postby Little Angel » Tue Oct 26, 2010 10:36 am

Just to be clear, this package includes the "Asset Pre-Processor" and the "Create UI Button"
scripts, as well as a batch button maker and a prefab maker script.
Little Angel
 
Posts: 772
Joined: Thu Sep 02, 2010 10:23 pm

Re: Custom Items for EZGui

Postby Little Angel » Thu Dec 09, 2010 9:07 am

If anyone has any specific feature request for any of these tools, let me know. I'm sure they are easy to re-code to suit one's own needs, but I'm willing to try to meet other needs or incorporate changes made by other users.
Little Angel
 
Posts: 772
Joined: Thu Sep 02, 2010 10:23 pm

Re: Custom Items for EZGui

Postby jrricky » Wed Mar 02, 2011 2:53 pm

Hey LittleAngel, in your script Make Prefab, is there any way not to let it name the prefab with the naming convention "prefabObjectname"? I just want it to be "Objectname".
jrricky
 
Posts: 45
Joined: Mon Sep 27, 2010 3:09 pm

Re: Custom Items for EZGui

Postby Little Angel » Fri Mar 04, 2011 3:26 pm

Hi, jrricky, I think we answered this in irc. Not sure what the issue was.... glad it seems to have gone away.

The script is very very simple...just a handful of lines and the path and object name lines are very obvious and easy to change.

This is the line:
var prefab : Object = EditorUtility.CreateEmptyPrefab ("Assets/Elements/PreFabs/Temporary/" + t.gameObject.name + ".prefab");
... that you need to change to set your path: ("Assets/Elements/PreFabs/Temporary/
... and your name: " + t.gameObject.name + ".prefab")

t.gameObject.name should just be the "name" of the GameObject with the added suffix ".prefab". You can change this to be anything you want, but I believe you need ".prefab" for Unity to understand that the object is a prefab.

Code: Select all
@MenuItem (Tools/Make PreFab")
static function MakePreFab() {
   var transforms : Transform[] = Selection.transforms;
   for (var t : Transform in transforms) {
      var prefab : Object = EditorUtility.CreateEmptyPrefab ("Assets/Elements/PreFabs/Temporary/" + t.gameObject.name + ".prefab");
      EditorUtility.ReplacePrefab(t.gameObject, prefab, ReplacePrefabOptions.ConnectToPrefab);
   }
}
Little Angel
 
Posts: 772
Joined: Thu Sep 02, 2010 10:23 pm

Next

Return to EZ GUI Add-ons

Who is online

Users browsing this forum: No registered users and 3 guests