Hot answers tagged

3

I know this question is old but it came up as the first result. In the current version (1.19), the right approach is to create your own type using generics as you mentioned. [System.Serializable] public class AssetReferencePlayerMaster : AssetReferenceT<PlayerMaster> { public AssetReferencePlayerMaster(string guid) : base(guid) { } ...


2

To use your code created Mesh with the collider you need to assign it to be used by the MeshCollider and MeshFilter component. Then on your MeshCollider in the editor, in the Cooking Options selection, select Everything. Example of the assignments in your Start() function, in this case I'll call it mesh and will have this: void Start() { mesh = new ...


1

I re-factored the function to (mainly to keep track of the a,b,c variables) and it seems to have done the job. Simply taking the target position away from initial position seems to have been the answer. Rubber ducking at its finest. private void CalculateTimeToHeightAndPosition(Rigidbody rb, float targetHeight, ref float timeToHeight, ref Vector3 ...


1

When you change handedness, all angles are negated. So all you have to do is negate the torque. If I'm reading your question correctly, your source coordinate system is: x+ forward y+ right z+ down In that coordinate system, a torque of (0, 0, -1000) should rotate left (counter-clockwise if we're looking down on the plane of rotation). To see this, point ...


1

The reason why you are getting those results is that the algorithm for coloring UI elements (or any other sprite using the default sprite shader) is to take the image (in this case the button background) and multiply the color values of each pixel with your chosen color. That means only those pixels which are pure white (RGB value 255, 255, 255) become that ...


1

Could it be your version? I'm running Unity 2020.3.19f1, and using your code this is what I see: What version are you currently running? You may also want to try: yellowBackgroundStyle.onNormal.background = MakeBackgroundTexture(10, 10, Color.yellow); The onNormal property also allows you to set specific styling when a GUI element is in the Normal state.


1

I use a utility class for my async/await conditionals. I have slightly modified it for your use case (untested): public static class TaskUtility { private static readonly int DeltaTime; static TaskUtility() { DeltaTime = 1000 / MainCamera.instance.MaxFrameRate; } /// <summary> /// Whiles while the function is true ...


1

Here's a slightly more explicit test: public class IfTest : MonoBehaviour { public GameObject toAssign; void TestIfs() { if (toAssign) { Debug.Log("if (gameObject) passes."); } else { Debug.Log("if (gameObject) fails."); } if (toAssign != null) { Debug.Log("...


1

As suggested by DMGregory, one solution to apply depth bias is to use the Offset keyword : Shader "Custom/Highlighted" { SubShader { Tags { "RenderType"="Opaque" } Offset 0, -1 //pulls the polygon closer to the camera ... } ... } Another way is to transform vertex into view space, modify ...


1

So, this is dumb, I ended up figuring it out. I didn't have to include InputSystem in Core, I had to include it in Character. I don't know why I was selecting the wrong one. So, double-check if it's actually the assembly you think that needs the dependency, and don't always trust what file gets opened when you double click the error.


1

I think you are looking for coroutines. A coroutine is a method which can interrupt itself using the yield return statement in order to be later resumed on another frame. This is useful when you have sequences of actions you want to perform within pauses between them instead of all at once. This example will log "1", "2", and "3"...


Only top voted, non community-wiki answers of a minimum length are eligible