r/UnityHelp • • Aug 29 '21

Trying to understand Corutines

2 Upvotes

Shouldn't this pritnt "Text" in the console every 3 three seconds?

IEnumerator test()

{

Debug.Log("text");

yield return new WaitForSeconds(3);

}

I ofc start corutine in update.

It spams the output every frame rather than every 3 seconds


r/UnityHelp • • Aug 15 '21

Solved MonoBehaviour won’t turn blue for me so I can’t use any of the unity functions in visual studio.

2 Upvotes

I’ve updated both unity and visual studio I’ve checked to make sure visual studio had the unity package turned on and it does. I have no idea why it isn’t lighting up and there’s nothing I can do until it does. Any help would be appreciated


r/UnityHelp • • Jul 25 '21

why can't I slice on the Sprite editor?

2 Upvotes

r/UnityHelp • • Jul 24 '21

PLEASE HELP MY TREES

2 Upvotes

https://drive.google.com/file/d/1bV4aTucTkl32gDdYV1_D3n_xhGaz0jJD/view?usp=drivesdk

This pop up is on every tree asset I downloaded from the Unity library. No information I found online is helpful. There is one video but it is too tedious to do for everything single tree. I need a quick change.

Please reply as soon as you can. I need to finish this enviromement for Monday for my Masters portfolio.


r/UnityHelp • • Jun 24 '21

HELP! scriptable objects losing data between sessions

2 Upvotes

my game uses a set of scriptable objects i call 'character sheets' to store all the data pertaining to each character. the character sheets have public fields for numeric data like stats, it has lists of other scriptable objects (for skills and equipment), it has sprits for character images, and it has a field for the animator to be used with that character.

between when i close down unity for the night and open it up again, the fields (other than the numeric ones ) will some times ether empty, or change to another file.

character sheets are only set one of 2 ways, either manually in the inspector, or when a you load a save file. and i know that the issue isn't with the load/save because it was working yesterday, perfectly fine, and on opening unity today its suddenly busted.

someone suggested that a hidden constructor was causing the issue, but i wrote the code my self and added no such thing. i even checked and there are no places in the code where it sets the effected variables.

I suspect that this has something to do with the editor, and if anyone has any idea what could be causing it I would very much like to know


r/UnityHelp • • Jun 05 '21

UNITY help with object sticking

2 Upvotes

I am very new to C# and unity in general, I am trying to make an object stick to another (player's wings to it's body for convenience) how can I do that?


r/UnityHelp • • Apr 11 '21

If on unity I have the build settings for Android can I still use the remote on my apple phone to test?

2 Upvotes

r/UnityHelp • • Apr 10 '21

How do i fix this NullReferenceException im having?

2 Upvotes

Im using raycast to create a shooting function in my game and when i click to fire a NullReferenceException comes up, Here is my following code:

 void Update()
     {
         if (Input.GetButton("Fire1")) 
         {
             Shoot();
         }
     }
 
     void Shoot() 
     {
 
         Ray ray = mainCam.ScreenPointToRay(new Vector3(0.5f,0.5f,0));
         RaycastHit hit;
         if (Physics.Raycast(ray, out hit, database.weapons[id].range)) 
         {
             if(hit.transform.tag == "Enemy")
             Debug.Log(hit.transform.name);
             CharacterStats enemyStats = hit.transform.GetComponent<CharacterStats>();  
             enemyStats.TakeDamage(database.weapons[id].damage);
             Debug.Log(database.weapons[id].damage);
             
         }
     }

Specifically on the line where it says " Ray ray = mainCam.ScreenPointToRay(new Vector3(0.5f,0.5f,0));" is where i get the error. mainCam just refers to a variable that is assigned the value of Camera.main. What causes this problem?


r/UnityHelp • • Mar 12 '21

I have a problem that my jump animation just shows the first few frames. I followed the tutorial by brackeys about 2D animation. Does someone know what to do. Thx

2 Upvotes

If you guys need more information tell me thx... again


r/UnityHelp • • Mar 12 '21

I have a problem that my jump animation just shows the first few frames. I followed the tutorial by brackeys about 2D animation. Does someone know what to do. Thx

2 Upvotes

If you guys need more information tell me thx... again