Quantcast
Browsing all 64 articles
Browse latest View live

Multi-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 Article


Is 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 Article


UI 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 Article

Any 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 Article

Find 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 Article


UI 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 Article

Overlay 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 Article

Teleporting 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 Article


Switching 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 Article


PropertyDrawer: 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 Article

Bake 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

Does a Child Canvas (Canvas in a Canvas) have some sort of merit?

I see that the canvas has a functionality to become a child of another canvas. When setting it, you inherit all of the values besides a couple which you can set manually (i.e. Pixel Perfect). Are there...

View Article

Finding path(Directory) of Script from class

I know you can find the path of the script file if you have an instance: `AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(instance));` However it seems odd to me that you need to have an...

View Article


Importing Rig, 'Avatar Definition' setting

I don't quite understand how the rig importing works. I am using Ethan from the third person controller standard asset. It comes with a couple animations which the avatar definition is set to "Create...

View Article

A problem with an object following a player and camera?

So there is a player and a droid and a camera in the scene. The player is moved with fixed update (because it has physics) The camera is moving with lateupdate (Using transform.position of the player...

View Article


Make waves like in Battlefield 4

I want to make a game with an cool ocean. However, I do not know how to approach this. I think the way is to use procedural mesh or preanimated object in a 3ed software like blender. If it were you,...

View Article

Store Multiple values in one variable

Is there a way to store multiple values in one variable? For example, there is a variable named sample. And var sample equals to an int of 5 and also an Boolean of true. i.e. var sample = new (int 5,...

View Article


Finding a value in a List

I need to find a value in a List. This is an example code that shows what I would want to do. private List spaces; private gridSize = 2.5; public struct Space{ public Vector3 coor; public Vector3 pos;...

View Article

How to use dot product return value

So, is there anyway to make the dot product change linearly? What I mean by this is when the angle is 45 degrees, I want it to be 0.5 instead of 0.7071 as you can see in this image: ![alt text][1] [1]:...

View Article

Is unity magnitude in km/h or m/s?

The tittle says it all. If you debug.log(rigidbody.velocity.magnitude), do you get this is km/h or m/s if 1 unity unit is 1 meter.

View Article
Browsing all 64 articles
Browse latest View live


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