Quantcast
Channel: Answers by "IvovdMarel"
Browsing all 145 articles
Browse latest View live
↧

Answer by IvovdMarel

Is Container[0] referencing the prefab? If you don't Instantiate the object, the Start function will never run on it.

View Article


Answer by IvovdMarel

The easiest way to have the camera follow the position and rotation of another object is to make it a child of that object. If you really only want to follow the rotation and add an offset I would go...

View Article


Answer by IvovdMarel

https://unity3d.com/learn/tutorials/topics/graphics/making-transparent-shader You can just look at the source-file at the bottom but probably worth checking out the video

View Article

Answer by IvovdMarel

A common mistake of the 'while' loop. Anything that you put in while will infinitely repeat until the condition is no longer true. This is very different then putting something in Update, which checks...

View Article

Answer by IvovdMarel

You should (almost) never change the z-value of UI elements. To order, change the hierarchy in Unity. In this case, it seems like the blue background is actually part of the button. Therefore, when...

View Article


Answer by IvovdMarel

The Unity Manual would be the place to start: https://docs.unity3d.com/Manual/AssetBundles-Workflow.html

View Article

Answer by IvovdMarel

You'd have to use a variable that persists through your scene-switch. Easiest: Create a static variable e.g. public class LevelManager { public static string currentLevel = "MyFirstLevel"; } and change...

View Article

Answer by IvovdMarel

Vector2 rotatedDirection = Camera.main.transform.TransformVector(direction);

View Article


Answer by IvovdMarel

Download the latest version of Unity. There's the learn tab

View Article


Answer by IvovdMarel

What platform are you aiming to build for? If you're exporting to Web or another AoT (ahead of time compilation) platform, this can be a struggle. If you're building a standalone build though using...

View Article

Answer by IvovdMarel

The null reference exception comes from either the SortedList being null or the UnitInfo component being null. Has your SortedList been initialized? UnitInfos = new SortedList(); Does every tagged...

View Article

Answer by IvovdMarel

I recommend using transform.InverseTransformPoint to calculate the local position of the collision. You should only have to look at the x or z value then (as the origin would be 0,0,0)

View Article

Answer by IvovdMarel

Yes FixedUpdate will do what you need. https://docs.unity3d.com/ScriptReference/MonoBehaviour.FixedUpdate.html https://unity3d.com/learn/tutorials/topics/scripting/update-and-fixedupdate

View Article


Answer by IvovdMarel

This is the old way of displaying UI and definitely not the easiest if you're trying to create a custom score-field. I recommend watching some tutorials such as:...

View Article

Answer by IvovdMarel

Depending on how you are modifying the y, you should look at Global: //These two lines do the exact same thing. transform.postition += new Vector3(0,5,0); transform.Translate(0,5,0, Space.World):...

View Article


Answer by IvovdMarel

The error will no longer pop up, and your code will compile, but it definitely does not fix the problem. You're basically telling the program to 'try' and run this code, but if there is any error you...

View Article

Answer by IvovdMarel

Try: EventSystems.EventSystem.IsPointerOverGameObject

View Article


Answer by IvovdMarel

Using transform.Translate will always cause these kind of issues as it disregards the physics system. You'll have to move your object using the physics system, by accessing your Rigidbody component....

View Article

Answer by IvovdMarel

if (reloading) { if (currentAmmo <= 0) { if (ammoInventory >= 40) { currentAmmo += 40; ammoInventory -= 40; } else { currentAmmo += ammoInventory; ammoInventory = 0; } } }

View Article

Answer by IvovdMarel

Just an updated answer on this, as Unity updated their prefab system: //Get path to nearest (in case of nested) prefab from this gameObject in the scene string prefabPath =...

View Article
Browsing all 145 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>