monodevelop

GetComponent function returning null

天涯浪子 提交于 2021-02-05 06:16:25
问题 I'm developing a simple game in Unity 2017 in C#. In my levels menu I have a Text object with a button component in it, and a script attached to it. This is what's currently in the script: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class LevelLock : MonoBehaviour { public bool isLocked = true; private Button lvlBtn; // Use this for initialization void Start () { lvlBtn = GetComponent<Button> (); if (lvlBtn != null) { Debug.Log (

How to get Rid of this error: not all code paths return a value?

血红的双手。 提交于 2021-01-27 17:01:34
问题 int search(string [][]mat, int n, string x){ //set indexes for top right element for(int i = 0; i<n; i++) { for(int j = n-1; j>=0; j--) { if ( mat[i][j] == x ) { Debug.Log(x +""+"Found at "+i +" "+j); // int[] n2 = new int[] {2, 4, 6, 8}; // int [] xyz = new int [] {i, j}; return i; } } }} How to get Rid of this error: not all code paths return a value? Error: * Assets/Scripts/Chess/Bishop.cs(237,22): error CS0161: `Bishop.search(string[][], int, string)': not all code paths return a value *

Unable to use System.XML.Linq

霸气de小男生 提交于 2021-01-27 12:43:18
问题 I am working on a project using Mono for Android. After reading a cross-platform document with Xamarin. I had my data layer in a separate project and was going to move it to my Mono for Android project and then link those files to my Mono Touch project, and one day perhaps a Windows Phone 8 project. When I moved the code, I am now unable to compile because of the System.Xml.Linq reference. The reference shows in the Mono for Android project, but I am unable to use it. I thought aiming for

How to jump in Unity 3d?

守給你的承諾、 提交于 2020-08-17 11:59:06
问题 can anyone share with me a script that I could use for jumping of the character for this script? I would greatly appreciate it, I'm 12 and just starting, it would help me to finish my project. Thank you in advance. 回答1: I would recommend starting with some of the courses on their website (http://unity3d.com/learn ),but to answer your question the following is a general script that would work. using UnityEngine; using System.Collections; [RequireComponent(typeof(Rigidbody))] public class

Problems trying to use Monodevelop on Manjaro

◇◆丶佛笑我妖孽 提交于 2020-07-10 07:21:53
问题 I can't get monodevelop to work on Manjaro . I tried all the different options to install in AUR ( monodevelop-beta , monodevelop-bin , monodevelop-git , monodevelop-nuget3 , monodevelop-stable ) and most of them failed to build. The only one that didn't fail was monodevlop-bin , but I couldn't get it to build my program. At first I got this error: The imported project "/usr/lib/mono/msbuild/15.0/bin/Roslyn/Microsoft.CSharp.Core.targets" was not found. Confirm that the path in the <Import>

Access Current System Time Zone

大城市里の小女人 提交于 2020-06-27 12:49:06
问题 Basically I can able to detect list of system time zones using following code: foreach(TimeZoneInfo info in tz) Debug.Log("time zone id : " + info.Id + " display name : " + info.DisplayName); Running this code, I have following output in console. In this list, I want to know, which one is my current system is following? Because I want specific information about that time zone. As like in following code, I was written clear "Asia/Kolkata". TimeZoneInfo infos = System.TimeZoneInfo

An error occurs when trying to set a child to my GameObject in script

家住魔仙堡 提交于 2020-06-27 10:45:27
问题 GameObject enemy = Instantiate(spawnObject,spawnPosition,spawnObject.transform.rotation) as GameObject; enemy.transform.parent = transform; The above code generates the expected result when I test my game in game mode, however I'm gettting this error message: "Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption." Yes, the spawnObject variable contains a prefab, however creating a new GameObject should have fixed the problem, I assume? 回答1: Check

An error occurs when trying to set a child to my GameObject in script

无人久伴 提交于 2020-06-27 10:45:00
问题 GameObject enemy = Instantiate(spawnObject,spawnPosition,spawnObject.transform.rotation) as GameObject; enemy.transform.parent = transform; The above code generates the expected result when I test my game in game mode, however I'm gettting this error message: "Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption." Yes, the spawnObject variable contains a prefab, however creating a new GameObject should have fixed the problem, I assume? 回答1: Check

C# The type or namespace name `List' could not be found. But I'm importing System.Collections.Generic;

橙三吉。 提交于 2020-05-07 21:22:54
问题 I'm having an error The type or namespace name `List' could not be found. Are you missing a using directive or an assembly reference? Sample code: using UnityEngine; using System.Collections; using System.Collections.Generic; public class city1 : MonoBehaviour { public static List<string> items = new List (); public static List<double> itemsprice = new List(); public static List<double> qu = new List(); } I'm using mono if it matters. 回答1: The issue comes from your instantiation of new List()

C# The type or namespace name `List' could not be found. But I'm importing System.Collections.Generic;

大城市里の小女人 提交于 2020-05-07 21:16:08
问题 I'm having an error The type or namespace name `List' could not be found. Are you missing a using directive or an assembly reference? Sample code: using UnityEngine; using System.Collections; using System.Collections.Generic; public class city1 : MonoBehaviour { public static List<string> items = new List (); public static List<double> itemsprice = new List(); public static List<double> qu = new List(); } I'm using mono if it matters. 回答1: The issue comes from your instantiation of new List()