A list in a class... Am I doing it wrong??
Hello guys! So This is a code from part of my script. So my question is, I created a class which contains vector3s floats and a list and for some weird reason, I assign a list to the class object...
View ArticleHow to use Inheritance and Constructors in Unity
I have a difficult time trying to implement inheritance and constructors in unity. Are there any examples that use this ideas? I am asking this because I have a hard time scripting in unity while I...
View ArticleHow does the districts painting work in cities skyline?
This is an example of what I am trying to ask So to be specific, here is the questions that I want to ask -How does the brushed area work? -How does the boarder of the painted area work? -How is the...
View ArticleWhere to start learning about shaders and GPU programming
Where can I start to learn about shaders, gpu programming and graphics processing terms? I have tried to search on google but I have no idea where to start(I don't know what to search for). I did find...
View ArticleHow does unity draw out Debug.DrawLine?
Does unity use line render to draw these lines? Or does it use something else... If it does use something else, what is it? and which one is faster? Thanks
View ArticleCustom Editor, variables declared in custom editor script resets
When creating a variable in a class that extends Editor, the variables are not serialized and it resets back to the default values. In this case, I want to display a enum in the inspector that is...
View ArticleCustom Editor, drop down similar to shader menu
Is there a way to have a drop down menu like the shader menu where there are categories and subcategories? (Seen in the image below) ![alt text][1] EDIT: Or, is there some way to indent in the popup...
View ArticleWhat is EditorPrefs in general?
I have read the documentation but all it says is Stores and accesses Unity editor preferences. but what exactly does it store? I dont get it...
View ArticleScriptable Object and Polymorphism
So I have a scriptable object which has a list of BaseClass. However, there are other classes that I wrote which inherits from the BaseClass. So I decided to use Polymorphism and shove everything in...
View ArticleMulti-editing is not supported with drawDefaultInspector?
I have a simple code: using UnityEngine; using UnityEditor; using System.Collections; [CustomEditor(typeof(ItemContainer))] public class ItemContainerEditor : Editor{ public override void...
View ArticleIs it better to check before you change variable
instead of updating every frame, is it better to do: if(valueToChange != targetValue) valueToChange = targetValue I am asking this because I wondered if setting a value takes longer than getting and...
View ArticleUI how to listen for OnSubmit
This is almost similar to aInputField.onEndEdit.AddListener(delegate{whatever method}); However, I do not want to trigger the function on loose focus but only when the user presses enter
View ArticleAny tips and tricks for organizing code
As I program more and more, and as the project grows larger. It seems to get really hard to organize code. Specific questions I have for organizing code is: -When to create a new script -When the...
View ArticleFind color of pixel from sampler2D using pixel coord or Finding the dimension...
Is there anyway to find a pixel value of a sampler2D using pixel coord? Or is there a way to get the dimension of the texture? Right now all I can do is tex2D(sampler2D, UV). However, I need to find...
View ArticleUI text - A lot of them or One big one?
I need to update in real time a long piece of string with the UI Text. The system that I am working on is something like a debug console. I was wondering which is better for performance to display a...
View ArticleOverlay UI, does it cull hidden UIs? (i.e. elements out of canvas)
I was wondering if the UI automatically cull hidden rects or render only the visible part of the canvas
View ArticleTeleporting INTO trigger or overlapsphere
When the character controller moves with transform.position (teleporting) and if there is a trigger or overlap sphere in the destination, it does not trigger. Is there anyway to solve this issue? Is...
View ArticleSwitching Texture in Shader or Script
I want to write a shader that has couple different sets of textures. I am planning to use a property field, or maybe #define to switch witch texture should be used. Alternatively, I might use a script...
View ArticlePropertyDrawer: Texture2D preview not showing up
SerializedProperty sp = property.FindPropertyRelative("springTexture") sp .objectReferenceValue = EditorGUI.ObjectField(position, "asdf", sp .objectReferenceValue, typeof(Texture2D), false); I have the...
View ArticleBake Lights and Realtime GI on Moving Object
As far as I know, you can only bake on static objects. Is there anyway to disable this? Since my game world consists of large enterable vehicles and there are many rooms that is closed off to the...
View Article