r/UnityHelp • • Jan 28 '22

Unity Package Manager Error

3 Upvotes

Hello, I have an error with creating a project with unity Hub (Editor 2021.2.9)

Here is the error message:

Could not find Unity Package Manager local server application at [/Applications/Unity/Hub/Editor/2021.2.9f1/Unity.app/Contents/Resources/PackageManager/Server/UnityPackageManager]. Missing files could be the result of an antivirus action or a corrupt Unity installation.

I tried to look it up but I don't have a Unity.app folder.

How do I get it? I tried to reinstall it and still there is nothing there.

I'm on a MacBook M1.

I appreciate any help.


r/UnityHelp • • Jan 22 '22

License problem

3 Upvotes

Hi guys i want to start working in unity. But i have a problem i can't activate my personal license when i try to accept nothing happens and after some time it closes automaticly and says that there is a problem but doesn't specify.I also download the unity but when i try to open it the HUB opens instead. If someone has any ideas please let me know. Thanks


r/UnityHelp • • Jan 18 '22

Does anyone know which section of this code is controlling the physical game object?

3 Upvotes

I'm creating a script that will change out the material of an object for a different one when prompted. So far the closest I've gotten is this, but this code works ONLY when the script itself is attached to that physical object. The issue with this is that I need this to be remote and not attached so I can edit the materials of multiple different objects from one single script. My question is what part of this code decides what physical object is affected and a follow up question what would I have to do to allow this to be made without having to put the script on the game object? Thank you to anyone who gives their time to this!


r/UnityHelp • • Jan 12 '22

cinemachine camera movement

3 Upvotes

so i made a third person camera for a character in unity using cinemachine that moves when you move your mouse, i want to change it to make it so i have to hold right click and move my mouse to look around, any idea how i would do that? also it uses a free look camera.


r/UnityHelp • • Jan 10 '22

Problems With Occlusion Culling

3 Upvotes

I'm trying to implement Unity's standard occlusion culling but I'm having trouble getting good results. A lot of objects that seem like they should be occluded are still being drawn.

Some info about the project/scene:

  • I'm using URP.

  • I have one camera in the scene and it has Occlusion Culling enabled and set to Everything.

  • All of my objects are static occluders and occludees (and all the other static flags are also enabled on them).

  • The walls, floors and other structural geometry are mostly modular, so there are very few large meshes that would be occluded poorly in that regard. Most of the geometry that's not occluding is opaque (and has an opaque material)

What I've tried:

  • I turned off static batching, SRP batcher and GPU instancing in case that was causing problems but there was no change.

  • I've tried various occlusion baking settings which did change the output but no combination gave good results.

  • I turned off dynamic occlusion on objects, that had no effect.

Occlusion culling is definitely working in some capacity but it's not working properly, or at least not well enough. The visibility lines pass through a bunch of geometry and end up drawing objects that are on the other side of the level with many objects in between.

Here are some screenshots of the scene

  • Top Left is what the scene looks like without occlusion

  • Bottom right is the scene with occlusion on, with the camera to the left. You can see on the top right there's a section of the level that's behind multiple layers of walls and yet is still drawing

  • Bottom left is the previous image with visibility lines enabled. Honestly I'm not entirely sure how these work but it seems strange to me that they're going as far as they are

  • Bottom Right is the camera view

I tried putting a big cube in front of some of the offending geometry to see what would happen:

Before
After

It's still failing to occlude everything behind it, but interestingly, it is occluding more than before. That giant cube should definitely be hiding everything behind it as far as I understand and I'm really not sure of the logic behind why it's only hiding certain things.

Any insight on why the results aren't great would be appreciated. Am I doing something wrong? Or am I just hitting engine limitations?

Thanks


r/UnityHelp • • Jan 06 '22

PROGRAMMING (UI) How to call some function when no option is choosen in dropdown?

3 Upvotes

As in title. I want to call some function when user clicks beyond of dropdown and it hides options.


r/UnityHelp • • Dec 25 '21

Solved how do i unlock this shader, i tried clicking the dropdown menu but it wont let me change anything

Post image
3 Upvotes

r/UnityHelp • • Dec 21 '21

When to use Referances and when to use GameObject.FindWithTag()?

3 Upvotes

I'm just starting out and this question really bothers me. Sure, there are times where only the GameObject.FindWithTag() works, for example if you have mutiple 'players' and want to switch between them or you delete them and then spawn them again. Then a reference would not work. But what is the 'best case' for all the other situation. Is it advised to use References whenever possible or is it smarter to just create a Tag for every object that you want to refer to in your C# code?

Are there public resources on this? Or is there a completely different approach to this?


r/UnityHelp • • Dec 15 '21

Fixing my movement script.

3 Upvotes

Hey unity community!

Im making a 2D platformer ( I know, very original) and my character moves and jumps around perfectly. My problem is that it keeps moving through walls.

  1. using System.Collections;

  2. using System.Collections.Generic;

  3. using UnityEngine;

  4. public class Playermove : MonoBehaviour

  5. {

  6. Animator playeranimator;

  7. Rigidbody2D playerRb;

  8. public float speed = 4f;

  9. bool facingRight;

  10. private bool isGrounded;

  11. public Transform feetpos;

  12. public float checkradius;

  13. public LayerMask whatisground;

  14. public float jumpforce;

  15. private float jumptimecounter;

  16. public float jumptime;

  17. private bool isJumping;

  18. // Start is called before the first frame update

  19. void Start()

  20. {

  21. playeranimator = GetComponent<Animator>();

  22. playerRb = GetComponent<Rigidbody2D>();

  23. }

  24. // Update is called once per frame

  25. void Update()

  26. {

  27. //get ground

  28. isGrounded = Physics2D.OverlapCircle(feetpos.position, checkradius, whatisground);

  29. //Get input

  30. float movement = Input.GetAxis("Horizontal");

  31. //Move along the x axis

  32. Vector3 playerPosition = transform.position;

  33. playerPosition.x = playerPosition.x + movement*speed *Time.deltaTime;

  34. transform.position = playerPosition;

  35. //Jump

  36. if(isGrounded == true && Input.GetKeyDown(KeyCode.Space)){

  37. isJumping = true;

  38. jumptimecounter = jumptime;

  39. playerRb.velocity = Vector2.up * jumpforce;

  40. }

  41. if(Input.GetKey(KeyCode.Space) && isJumping){

  42. if(jumptimecounter > 0){

  43. playerRb.velocity = Vector2.up * jumpforce;

  44. jumptimecounter -= Time.deltaTime;

  45. }

  46. else{

  47. isJumping = false;

  48. }

  49. }

  50. if(Input.GetKeyUp(KeyCode.Space)){

  51. isJumping = false;

  52. }

  53. /*

  54. if(Input.GetKey(KeyCode.Space) )

  55. {

  56. playerRb.AddForce(Vector2.up*1f, ForceMode2D.Impulse);

  57. }

  58. */

  59. //prevent sliding down slopes

  60. if(Input.GetKey(KeyCode.Space) == false || Input.GetAxis("Horizontal") == 0){

  61. playerRb.constraints = RigidbodyConstraints2D.FreezePositionX | RigidbodyConstraints2D.FreezeRotation;

  62. }

  63. else{

  64. playerRb.constraints = RigidbodyConstraints2D.FreezeRotation;

  65. }

  66. Flip(movement);

  67. //Change Animation

  68. playeranimator.SetFloat("Speed", speed*0.75f);

  69. playeranimator.SetFloat("Move", Mathf.Abs(movement));

  70. playeranimator.SetBool("Jump", isJumping);

  71. }

  72. void Flip(float m)

  73. {

  74. //Get current direction and compare it to movement direction

  75. if(facingRight && m < 0 || !facingRight && m > 0)

  76. {

  77. //if they are not the same, then flip and change facingdirection

  78. transform.Rotate(new Vector3(0,180,0));

  79. facingRight = !facingRight;

  80. }

  81. }

  82. }

Thats my movement script in its entirety. I wasnt sure how much of it was needed.

I think that this part is whats causing the problem.

  1. Vector3 playerPosition = transform.position;

  2. playerPosition.x = playerPosition.x + movement*speed *Time.deltaTime;

  3. transform.position = playerPosition;

I have tried replacing that part with various solutions using rigibodies but that just causes my character to slowly move downwards and not be able to move side to side.

Please help. Thank you.


r/UnityHelp • • Nov 30 '21

Can someone explain why this string equality doesn't work before i run into a wall head-first

3 Upvotes

if (data[1][0] == data[2][4]) .....this doesnt work although the string underneath is identical when I debug. why??

if (data[1][0] == name)...... this doesnt work either.. unless i do 'name = "the string here". why???

Im 8 hours in and have scoured google, reddit, stackoverflow, microsoft docs.. please help!


r/UnityHelp • • Nov 29 '21

How do I get these numbers in code? (Highlighted yellow)

Post image
3 Upvotes

r/UnityHelp • • Nov 28 '21

Drawing or visualizing geometry

3 Upvotes

I'm currently working on a personal tool for some geometry maths, but I want to be able to visualize them also. I'm trying to figure the latter, but am having trouble as I've only learned of three ways to draw a line, with a fourth seeming improper (I want to also use days geometry told in production).

I can...

draw gizmos

Debug.drawline (impractical)

(Editor only) Handles class

The fourth being instantiating game objects to render a texture via length over time (l/t).

Is there another way I can accomplish this that permits build or runtime use?

I want to be able to do so for lines, curves, shapes/polygons etc.

I have yet to look into the cs ref for colliders (gizmos) but that's my next step.

My reason is because either I don't understand some relevant workings of Unity APIs (most likely) or they don't exist and I want something I can intelligibly work with.


r/UnityHelp • • Nov 12 '21

PROGRAMMING I'm trying to get a slide attack that can be used by pressing Z and Shift at the same time, where Sarah (my PC) travels a distance forwards, with a hitbox in front of her for breaking blocks and damaging foes. How do I code that?

Thumbnail
gallery
3 Upvotes

r/UnityHelp • • Nov 09 '21

Can someone help me fixing this animation glitch ?

3 Upvotes

r/UnityHelp • • Oct 30 '21

Solved I want to code my character so that when she crouches, her movement speed becomes slower. Here's my code. How do I fix it?

Post image
3 Upvotes

r/UnityHelp • • Oct 30 '21

Record a video from a web camera

3 Upvotes

Hi, I am trying to record a video from a web camera on my laptop. I have used this script (https://docs.unity3d.com/560/Documentation/ScriptReference/VR.WSA.WebCam.VideoCapture.html). Everything works fine, the video is recorded. BUT, I need to see what I am recording. I tried to add a webcamtexture script. The result was - empty mp4 file. Then I tried to add webcamtexture to a 3d object and record what camera sees in Unity. It was good, but don't want it this way, because I need to add a 3d object in the scene, which I don't want to be seen in the recorded video.

Is there any way for recording a video while I can see what am I recording?

Thanks for any answers :)


r/UnityHelp • • Oct 28 '21

PROGRAMMING Using Unity 2019.1.9f1, how can I script a third-person camera to rotate with the player so that it's always behind the player character? Here's the script for the camera.

Post image
3 Upvotes

r/UnityHelp • • Oct 17 '21

PROGRAMMING Question About Sprite Manipulation With Text

3 Upvotes

Hello Everyone, I am trying to create a gameobject that has a square sprite, the size of the gameobject is depended on 2 factors, one for height and one for width. I've managed to solve the function for height but I still can't manage to produce one for the width. It's function depends on a Text Mesh that is a child of the box. The more the character, the more space. Any idea how i can implement this function?

I have been struggling with problem for quite some time now and i have no clue where to go to solve it.

Thank you very much


r/UnityHelp • • Sep 30 '21

UNITY Anyone know how to bypass silent mode on IOS?

3 Upvotes

As the title.


r/UnityHelp • • Sep 30 '21

Error Exporting to iOS - what I do wrong?

3 Upvotes

So I recently worked on an App in Unity and exported it to Android project which worked fine.

However getting it on iOS seems to have some extra steps involving xCode etc. However, when trying to export the project as iOS I get errors so I cant make the .ipa(?) package.

I've attached image of Console errors, this might make some sense to someone. If anyone can help me get through this I would really appreciate it. If theres an expert here who can guide or assist I can pay, becuase this is frustrating and I cant find a fix ;_;

Thanks all <3


r/UnityHelp • • Sep 09 '21

guys i need help please

3 Upvotes

Hi guys, i need help, about 3 months ago I entered the world of gameDev and after creating a game I decided to broaden my horizons and add the online version. the game is for mobile so I should have added buttons to move the player. once added I noticed that when I created a game room and the player was spawned (the ui interface was also spawned with it) it was impossible to press the buttons to make the player move. Could you tell me some ways to fix the bug? Thanks in advance


r/UnityHelp • • Aug 22 '21

PROGRAMMING Input in Unity made easy (a complete guide to the new system) - Game Dev Beginner

Thumbnail
gamedevbeginner.com
3 Upvotes

r/UnityHelp • • Aug 21 '21

PROGRAMMING Best way to look at motion in 2d Platforms using Forces.

Thumbnail
youtube.com
3 Upvotes

r/UnityHelp • • Aug 21 '21

UNITY I cannot add Wave(0) Game Object in List<Transform> wayScript???????

Post image
3 Upvotes