Set Main Camera Programmatically
I am trying to write a C# method that will set the main camera programmatically. It should accept a camera that it will set as the main camera over all other cameras in the scene. I'm not sure where to...
View ArticleConstrain LookAt to Local Axis
I've been using the following code to constrain LookAt to a specific axis: Vector3 lookAtPos = target; lookAtPos.y = obj.transform.position.y; // constrain y axis obj.LookAt(lookAtPos); This constrains...
View ArticleRotate Around Local Y Axis
How does the unity rotate tool rotate around the local y axis? It seems that if I try to adjust localEulerAngles.y programmatically, we do not get the same effect. When rotating with the local rotate...
View ArticleSerialize Nested Lists
Will Unity not serialize nested lists such as: List> nList = new List>(); How can we serialize this list?
View ArticleExport Scene Objects to Package
What is the best way to export a number of scene objects to a file so that they may be imported into another scene?
View ArticleOpenSceneAdditive Remove Duplicates
I'm in the process of writing a script that will merge scenes with the option of removing duplicate GameObjects. The idea is to open a scene with EditorApplication.OpenSceneAdditive, and then check if...
View ArticleShow Scene Hierarchy in Editor
I need to show the scene hierachy in an editor window. At the moment, I am retrieving all GameObjects with GameObjects.Find and displaying them in alphabetical order. However, this does not take...
View ArticleProgrammatically Undo GameObject Deletion
I'm working on an extension and I need to give the user a popup message (DisplayDialog) offering to undo the deletion of a GameObject if it is needed by the extension. What I'm doing right now is...
View ArticleAsset Multiple License
I've been asked by a potential customer if they can use the same Asset Store account and download my Asset for different licenses of Unity on different computers. What is Unity's stance on this?
View ArticleGet Script Path
I'm working on an extension where resources are loaded from and exported to a fixed directory. Problems occur if the user puts the extension in a subfolder. How can we get the path of a script? Or is...
View ArticleReadPixels Screen is Offset
I'm using ReadPixels to capture the screen, but the texture always comes out quite a bit offset from the top. This is the code I'm using: Texture2D tex2d = new...
View ArticleAsset Importer, GUISkin Not Moved
I've released an update to an extension in the Asset Store. Within the update, a GUISkin file has been moved to a different folder; the new folder being a "Resources" folder. Importing the new update...
View ArticleReadPixels from Game View (EditorWindow)
I'm trying to save the current game view into a texture with ReadPixels. This works when the game is running with: Texture2D tex2d = new Texture2D(Screen.width,Screen.height,TextureFormat.RGB24,false);...
View ArticleIs RenderTexture Pro Only in 3.5?
I'm working on an extension that requires the use of RenderTextures. The documentation says that RenderTexture is Pro Only. I've tested the use of RenderTextures in a non-Pro installation of Unity and...
View ArticleUsing UnityEditor in runtime
Are we allowed to use the namespace UnityEditor in a runtime class? Will any of the UnityEditor methods be available to us on runtime?
View ArticleList Scene Contents
Is it possible to list a scene's contents without opening it from an editor script? In a similar way to how importing a package works, I would like to list a scene's contents before having the editor...
View ArticleGraphics.DrawTexture + GUI.color
How can we set the GUI color when using Graphics.DrawTexture? There seems to be a color parameter but it doesn't seem to be doing anything.
View ArticleManipulate Texture UVs with Shader
How can we manipulate a texture's UVs from a shader? I've taken a look at the [Shader Reference][1], but am still quite new to shaders and would like to be pointed in the right direction. Edit: Your...
View ArticleVerificationException EditorWindow.GetWindow
Hello, I'm getting the following VerificationException error: VerificationException: Error verifying MyEditorWindow:OnEnable (): Function pointer signature 'object,bool' doesn't match delegate's...
View ArticleLoad JSON Resource as TextAsset
Hello, I'm trying to load a text file that contains JSON data as a TextAsset. This works fine if the extension of .txt is used, For example myJson.txt works with: TextAsset t = (TextAsset)...
View Article