[Solved] Unity Doublejump in C#

Haven’t tested your code, but the following should work: using UnityEngine; public class PlatformerCharacter2D : MonoBehaviour { bool facingRight = true; // For determining which way the player is currently facing. [SerializeField] float maxSpeed = 10f; // The fastest the player can travel in the x axis. [SerializeField] float jumpForce = 400f; // Amount of … Read more

[Solved] Right to left letters in cards Unity

Without seeing any code, you probably want to flip your loop: for(int i = 0; i < cards.Count; i++) to for(int i = (cards.Count – 1); i >= 0; i–) But please share some code, so we can help. Edit: Corrected Loop. 4 solved Right to left letters in cards Unity

[Solved] Make a list of achievements in a scroll view

You assign the elements (name, description, currency) to the same UITexts. It is like you try to store 20 numbers (0,1,2…19), but you only have one variable (int) to store them. Try to create the texts in the for loop as much as you need. Here is an example: public GameObject filePrefab; // to be … Read more

[Solved] How to load YouTube live video streaming in unity? [closed]

asset store has plugins for youtube videos: https://www.assetstore.unity3d.com/en/?stay#!/search/page=1/sortby=relevance/query=youtube i’m pretty sure unity video player plays youtube videos also, if you pass it the actual mp4 youtube video url. (you need to extract it with those plugins, use some website api to extract it, or make your own) 2 solved How to load YouTube live video … Read more

[Solved] Unable to access variable in other class for text display [Unity]

You are never initializing the bask in GameManager.cs. public class GameManager : MonoBehaviour { Basket bask; public Text text_apple; // Use this for initialization void Start () { bask = GameObject.Find(“BaskNameInHierarchy”).GetComponent<Basket>() text_apple.text = bask.displayApple; //i want to call the method of displayApple to get the string returned. } } You can also make the bask … Read more

[Solved] The variable has not been assigned [duplicate]

The problem is that you don’t initialize the property private Material material; When you create object like that you create a reference that points to null. In your code you are trying to modify this object but since it’s not initialized it’s null. The solution is to initialize it in the constructor like so: public … Read more

[Solved] how to clearly design these two class? [closed]

It’s a question of design. Weapon has the field addPower, but IWeapon does not. This would imply, that not all weapons (not all classes that implement IWeapon) do add power to the character. So you can’t use this property, if the interface doesn’t define it. (Casting an interface to an implementing class defies the whole … Read more

[Solved] Unity 3D spawn 10 objects on mouseclick [closed]

To instantiate a prefab you can use Instantiate (as someone told you in a comment) https://docs.unity3d.com/ScriptReference/Object.Instantiate.html to do that 10 times use a simple for-loop: for(int i=0; i<10; ++i){ //code } so, putting all togheter the update functions can be: void Update () { if (Input.GetMouseButtonDown (“Fire1”)) { for (int i = 0; i < … Read more

[Solved] High score Unity C# [closed]

Please try Google before asking a question here… (StackExchange rule: Don’t ask about questions you haven’t tried to find an answer for) – e.g. http://answers.unity3d.com/questions/672869/player-prefs-to-store-high-scores.html If your actual question is how to save a highscore, use PlayerPrefs. For example, to save a highscore for later (every time you reached a new score, e.g. at the … Read more

[Solved] Modifying static variables from other scripts in Unity [duplicate]

Please, provide more information about how are you trying to do this… If you need to change between mono behaviours, for example, you will need to get current instance of behaviour you like to change in a way like myGameObjectInstance.GetComponent<MyBehaviourWithStatic>().myStatic = value; but note that user2320445 answer is not wrong, it depends on your context. … Read more

[Solved] Unordered Random Numbers [closed]

if you want to generate random numbers in range without repeating, you can try this: public static List<int> GenerateNumbers(int mn,int mx) { List<int> source = new List<int>(); for (int i = mn; i <= mx; i++) source.Add(i); var random = new Random(); List<int> randomNumbers = new List<int>(); while(source.Count != 0) { int randomIndex = random.Next(source.Count); … Read more