Collider for Unity Line Renderer

I have several line renderers that are using as gas pipelines. A user can select one end of the pipe and attach it to one connector. Now the problem is some pipes (line renderer) are overlapping and penetrating with each other. Is there any way to avoid penetration using colliders so they look realistic?

Unity Cloud Build: Corrupted reffernces. Reimport All Assets possible?

When refferences in scenes or prefabs are missing usually a reimport all fixes all issues, but when those problems occur in a cloud build, that get’s it’s data from a git repository the solution seems much harder. The AssetDatabase API allows for a reimport in a prebuild script:

using UnityEditor; using UnityEditor.Build; using UnityEditor.Build.Reporting;  class Reimporter : IPreprocessBuildWithReport {      public int callbackOrder { get { return 0; } }     public void OnPreprocessBuild(BuildReport report) {         AssetDatabase.ImportAsset("Assets", ImportAssetOptions.ImportRecursive);     } } 

But the UnityEditor libary isn’t accessible in a cloud build. Is there a way to fix missing refferences in a cloud build or trigger a reimport via a pre build script or something similiar?

PS: Local builds after a fresh checkout of the github project do not have this issue, and only Cloud builds suffer from these missing refferences. Maybe someone knows the root of the issue and how to overcome it, so that none of these hacky solutions would be required.

Circular draggable UI element in Unity canvas

I am trying to implement my own runtime color picker that’s easy to use for touch interfaces. I want the hue slider to be a ring, along these lines, except the whole ring texture would rotate when dragged.

I have scavenged enough code to get a raw image object rotating when dragged in a UI canvas in the manner I’m looking for:

    private float baseAngle;     private Vector2 pos;          public void OnBeginDrag(PointerEventData eventData)     {         pos = transform.position;         pos = eventData.pressPosition - pos;         baseAngle = Mathf.Atan2(pos.y, pos.x) * Mathf.Rad2Deg;         baseAngle -= Mathf.Atan2(transform.right.y, transform.right.x) * Mathf.Rad2Deg;     }      public void OnDrag(PointerEventData eventData)     {         pos = transform.position;         pos = eventData.position - pos;         float ang = Mathf.Atan2(pos.y, pos.x) * Mathf.Rad2Deg - baseAngle;         transform.rotation = Quaternion.AngleAxis(ang, Vector3.forward);     } 

Since it doesn’t use colliders, how can I limit the draggable region to a circle within the square bounds of the texture? Even better, also limit it to a ring rather than a whole circle. Will I have to implement my own check based on some pure math or is there a built in way?

thanks!

How to Get VR Controller’s Velocity in Unity with SteamVR?

Back when I used Unity 2017 and controller bindings weren’t a thing, I simply attached a rigidbody to my Vive controller and read out the velocity of the rigidbody to know how fast the player was swinging the controller. Now, I’ve updated to Unity 2021.2.0a14, I went through all the effort of modifying my code to work with bindings, and it doesn’t seem like I can get velocity anymore. The rigidbody always reports zero velocity. I can see the World Center of Mass vector changing so I know it registers motion, but it’s just not reporting the velocity anymore. Is there a new setting in Unity I need to turn on to measure things that it doesn’t personally control? Or do the new bindings options have a way to get velocity as an input? Am I forced to calculate it myself now? Thanks!

Pinch Gesture for Function Other than Zooming- Unity

I’m working on a game in which I want to pinch outwards on a character, which causes the character to split into 2 smaller copies of itself.

The method I’m thinking about using is to have the "pinch out" gesture destroy the game object and simultaneously create two instances of the smaller game object, and have them follow the fingers that pinch out. The action would also be reversible with the "pinch in" function.

My idea would be to do a raycast to detect the two-finger touch on the object (would I need a collider for that?), then use the beginning and ending touch points to determine if it is pinching out or in.

The problem is I am brand new to Unity and C# and have no idea how to write all of this. All of the tutorials for multi-touch gestures have to do with camera zoom, which is not what I am going for.

Can anyone tell me if I’m on the right track with my logic and provide some guidance on writing the code?

My timer wont work in unity

In my game, you can spawn a cube by clicking. After 10 seconds I want the cube to disappear. That’s what I’m trying to do in my code but it won’t work:

using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI;  public class circleThing : MonoBehaviour {     public GameObject circle;     public GameObject block;     public float time;     void Start() {          Vector3 temp = Camera.main.ScreenToWorldPoint(Input.mousePosition);          temp.z = 5f;          transform.position = temp;          if (Input.GetMouseButtonDown(0)) {              StartCoroutine(timer());              Instantiate(block, temp, Quaternion.identity);          }          if (time >= 10) {              Destroy(block);          }     }     void Update()     {            }      IEnumerator timer(){          while (true)         {             Debug.Log(time);             yield return new WaitForSeconds(1);             time++;         }     } } 

What am I doing wrong? I get the error: Destroying assets is not permitted to avoid data loss.

Why does Unity show dark regions on a model with animation created using Blender?

I sculpted a model in blender, and I want to import that to Unity. When I import just the model(without animation), Unity shows as is. However, when I attach armature to the body and automatically assign weights to it with the intention of creating an animation, Unity import shows dark regions all over the model. All the face normals look fine. I am not sure what the issue is.

Model in Blender: Model in Blender:

Weights: Weights

Dark patches in Unity: Dark patches in Unity