Quantcast
Channel: Latest Questions by karl_
Browsing all 90 articles
Browse latest View live
↧

Why is this giving me an error? (ToBuiltin problems)

I'm not quite sure what's happening here. I'm getting the error "InvalidCastException: Cannot cast from source type to destination type." However, I can't see anything wrong. Here is the code: var locX...

View Article


string.search() in Unity Javascript?

I'm trying to get a count of the number of instances of a char in a string.Is there any way to get this to work in Unity's JS?var amtOfXinString : int = stringToSearch.search("x");

View Article


While Loop crashing Unity consistently

I'd like this function to lerp from 0 to 1 and then exit, as opposed to running for a single frame then exiting. As you can see, I've tried wrapping Mathf.Lerp in a while() loop. However, this...

View Article

Create an array of gameobjects in trigger?

I'm trying to create an array and keep it updated based on what objects are currently in a trigger. Here is what I have so far, the problem is that I am getting a null reference error when sending...

View Article

Variable creation through Inspector using CustomEditor?

I'm working on a utility for an upcoming project, and I'm delving into the world of editor programming. I'm having trouble figuring out how to write a script that will allow the user to set a number of...

View Article


How to use Editor Styles?

I'm trying to get the same effect as the small button in the Unity inspector, but to no avail. Here's what I've got:EditorGUIUtility.LookLikeInspector(); if(GUILayout.Button("+", radioButton) ) { //...

View Article

Image may be NSFW.
Clik here to view.

Custom Inspector Element on Texture Importer?

I'm trying to get a custom editor to show up in the inspector for textures. If I use@CustomEditor(TextureImporter)it overwrites the Texture Importer settings. How would I go about attaching this to the...

View Article

The name 'List' does not denote a valid type ('not found')?

I declare my List like this: var sprites : List.<Texture2D> = new List.<Texture2D>();Which I'm almost positive is correct. However I get the error "The name 'List' does not denote a valid...

View Article


Set MinWidth for EditorWindow

Is it possible to set a minimum window width for an editor window? If so, how would I go about doing it?

View Article


Best Android Test Device?

I'm looking for a generic Android OS phone for testing apps. Is there a standard or will I need to purchase a couple of devices?

View Article

Time.deltaTime in Editor script

I've come to realize that Time.deltaTime does not update in an editor script. I need a timed countdown in this particular script. Is there any way to achieve this in editor?

View Article

Texture2D.format and TextureFormat.ARGB32 aren't comparable?

I'm trying to make sure that an image loaded into a game is of the ARGB32 format, but I can't seem to get Unity to compare the two. Code: if(image.format == TextureFormat.ARGB32) { // Stuff } This...

View Article

Custom Editor - Cast target as GameObject?

I'm trying to access the MeshRenderer component from a Custom Editor, but I can't seem to figure out the syntax in C#. In JS what I'm trying to accomplish: var mat : Material =...

View Article


Add Color Property to Unlit Alpha?

I'm attempting to add a Color field to the existing Unlit/Transparent shader. Here is what I have so far (Compiles, but does not actually modify the color): Shader "Custom/Unlit Transparent Color" {...

View Article

Set Vertices to Ground

I'm trying to set all the vertices of plane to match the height of the terrain. At the moment, it sets about half the plane to some random Y value and ignores the other half. I can't seem to figure out...

View Article


Making Duplicate Terrain Unique?

I need the ability to make a duplicate terrain unique, so that I may edit it's terrainData without affecting the original terrain. I found this question...

View Article

Open ObjectSelector window from Editor Script

I'm trying to replicate the Material ObjectField seen in the Inspector, except that I also want to view the material modifications to the texture. I've got everything working except for the Select...

View Article


Workaround for broken [PostProcessScene]

Pretty much what the title says. The PostProcessScene attribute works properly in editor, and debug logs say that it is fired during build sequences, but no changes to the scene ever make it to the...

View Article

Prevent implicit cast from Vector3-Vector2

Unity provides implicit casts between most of the Vector classes. This is nice in most situations, but is making debugging a nightmare for some of my code. I wrote conversion methods that accept an...

View Article

Rename a folder via code

I need to rename a folder at compile time. Specifically, as part of a build script. I've tried renaming with the command line then force re-importing assets as well as using an editor script with...

View Article
Browsing all 90 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>