SetStatic

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
m (Text replace - "</javascript>" to "</syntaxhighlight>")
m (page is orphaned I marked for deletion and set to redirect to page 'SetGOFlags' that contains a more full featured script with additional functionality)
 
Line 1: Line 1:
 +
#REDIRECT [[SetGOFlags]]
 +
 +
{{delete}}
 +
 
By: DaveA
 
By: DaveA
  

Latest revision as of 10:54, 10 December 2012

  1. REDIRECT SetGOFlags
This page is marked for deletion

By: DaveA

[edit] Description

Editor Utility that lets you set or clear the 'static' property on all selected objects and their children. Undoable!

Put this script into your project in the Editor folder. You will get the menu option GameObject->Set Static and GameObject->Clear Static

[edit] Code

[edit] Javascript - SetStatic.js

@MenuItem("GameObject/Set Static", false, 4) 
static function setStaticPicked() 
{ 
	Undo.RegisterSceneUndo ("Set Static");
	var trs = Selection.GetTransforms (SelectionMode.Deep);
	setStatic (trs, true);
} 
 
@MenuItem("GameObject/Clear Static", false, 4) 
static function clearStaticPicked() 
{
	Undo.RegisterSceneUndo ("Clear Static");
	var trs = Selection.GetTransforms (SelectionMode.Deep);
	setStatic (trs, false);
} 
 
static function setStatic(trs, state) 
{ 
	for (var tr in trs) 
	{ 
		tr.gameObject.isStatic = state;
	} 
}
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox