Hot answers tagged

6

Unity projects don’t include the source file in the project when building. Instead, every image is converted during import to a format useful to the GPU, as set by you in the import settings for that image. These tend to be larger, especially if an uncompressed format is chosen, and especially if the source image is in a compressed format (eg. jpeg, or png ...


4

You can use the official Unity Recorder asset. The latest Unity Recorder is available in Preview via the Package Manager from Unity 2018.3+, the asset store version is no longer being updated actively I believe.


2

You don’t. This would need to be simply a single-step achievement.


2

A very simple way to control the speed of a Unity game is by changing the value of Time.timeScale. The default value is 1, and higher values mean higher speed. 2 means twice as fast, 0.5 means half as fast, etc.. But keep in mind that this speeds up everything in your game. Often there are various things you do not want to speed up while the game progresses. ...


2

You know what? I will be generous. Here is a a script made by unity that pretty much does this for you. Enjoy. using System.Collections.Generic; using UnityEngine; namespace UnityEngine.Rendering { [HelpURL(Documentation.baseURL + Documentation.version + Documentation.subURL + "Free-Camera" + Documentation.endURL)] [ExecuteAlways] public class ...


1

var Obehaviour = other.gameObject.transform.parent.gameObject.GetComponent<UnitBehaviour>().Health; <--- Error is here. There are 3 reasons why this line could throw a NRE: other is null other doesn't have a parent the parent gameObject doesn't have a UnitBehaviour Keep in mind that when you put this code snippet into some event handler (I ...


1

Cameras are very sensible to anything that does not move them perfectly smoothly. The camera should be updated in an Update or LateUpdate. One way to handle cameras is to adjust variables in a FixedUpdate, and to move the camera in the (Late)Update based on the given variables. Moving the player in a FixedUpdate with the camera being parented to will cause ...


1

It's spelled Rigidbody2D, not RigidBody2D. Capitalization matters in C#.


1

Select an object you want to center your view on and press the F key to snap your scene view camera to that object, zoomed to fit it in view. "Frame Selected" is the name of this shortcut.


1

I have found the answer here. Although it is not completely explained mathematically in my opinion, it works well. The code I use is like this: private void Start() { // ... PositionCamera(); } /// <summary> /// Source: https://forum.unity.com/threads/dynamic-loaded-object-fit-to-screen-size.349794/ /// </summary> void PositionCamera()...


1

Figured out how to do it. I had to create a new assembly definition in my Scripts folder. (I also moved my Tests folder out of the Scripts folder to be on the safe side.) Then, looking at the Tests assembly definition in the Inspector, I added a new item to the Assembly Definition References list, which I made point to my MainAssembly.


1

What I’m describing was caused by the Rigidbody2D auto-calculate mass. Just uncheck that box and it should work fine!


1

As this question is kinda 2 questions in one, I'm going to answer the one that I think is the root of your problem (scale sphere relative to plane). Because if I read this correctly, the pixel part sounds like you only want to do that because you couldn't find the solution to your original problem. In Unity, a position is based on 'units'. a 'unit' doesn't ...


1

When the canvas is set to screen space overlay, the z isn't going to do anything as 'Screen space overlay' uses an orthographic camera which renders everything between z -1000 and z 1000 the same. It is not going to look like it is closer to the camera. That is just how an orthographic projection works.. I think you'd either want to set it to Screen space ...


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