Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Drfox80 · Jul 26, 2020 at 01:20 PM · c#unity 5string

cant get if (String.Equals(magicsetom[x], boxadd)) working

 using System;
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.Rendering;
 
 public class hudmager : MonoBehaviour
 {
     private GameObject[] magicbox;
     private string[] magicsetom;
     private string[] MagicNameloder;
     [SerializeField] private string boxadd;
     private bool startmagic;
     [SerializeField]private GameObject image,player;
     private float number=0;
     // Start is called before the first frame update
     void Start()
     {
       
     }
 
     // Update is called once per frame
     void Update()
     {
         MagicNameloder = this.GetComponent<texttomagic>().MagicName;
         magicsetom = this.GetComponent<texttomagic>().magicList;
         magicbox = GameObject.FindGameObjectsWithTag("magicbox");
         for (int i = 0; i < magicbox.Length; i++)
         {
             if (magicbox[i].GetComponent<hithandstest>().hit == true)
             {
                     if (number < 42)
                     {
                         boxadd +=""+ magicbox[i].transform.parent.name +"_" + magicbox[i].name+"/";
                         startmagic = true;
                         number += 1;
                     }
                     else
                     {
                         startmagic = false;
                     }
             }
             if (startmagic==false)
             {
                 boxadd = "";
                 number = 0;
             }
         }
 
         for (int x = 0; x < magicsetom.Length; x++)
         {
         
             if (boxadd !="")
             {
               
                     if (x % 2 != 0)
                     {
                         if (String.Equals(magicsetom[x], boxadd))
                         {
                         Debug.Log("" + magicsetom[x] + "==" + "" + boxadd+"runing");
                         Instantiate(Resources.Load("Magic/" + MagicNameloder[x + 1]), player.transform.position, Quaternion.identity);
                         }
                         else if (String.Equals(magicsetom[x] , boxadd))
                         {
                           //  Debug.Log("" + magicsetom[x] + "!=" + "" + boxadd);
                         }
                     }
               
 
             }
         }
         if (!image.activeSelf)
         {
             boxadd = "";
             number = 0;
         }
         
     }
    
 }
 ------------------------------------------------------------------------------------------------------------
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using System.IO;
 using System.Linq;
 using System.Data;
 using System;
 
 public class texttomagic : MonoBehaviour
 {
     public static List<string> textArray;
     private TextAsset txtAsset;
 
     [HideInInspector]
     public string[] magicList;
 
     [HideInInspector]
     public string[] MagicName;
 
    [SerializeField]
     private int[] RowstoReadfrom;
    
     // Start is called before the first frame update
     void Start()
     {
          txtAsset = (TextAsset)Resources.Load("code/maigc");
  
         readTextFile();
     }
 
     // Update is called once per frame
     void Update()
     {
        
     }
     void readTextFile()
     {
         textArray = txtAsset.text.Split('\n').ToList();
         for (int i = 0; i < RowstoReadfrom.Length; i++)
         {
             if (RowstoReadfrom[0] < 0 || RowstoReadfrom.Length == 0)
             {
                 magicList[0] = txtAsset.text;
             }
             else
             {
                 if (i % 2 != 0)
                 {
                     magicList[i] = textArray[RowstoReadfrom[i]] + "\n";
                 }
                 else
                 {
                     MagicName[i] = textArray[RowstoReadfrom[i]] + "\n";
                 }
             }
 
         }
 
     }
 }
 ------------------------------------------------------------------------------------------------------------
 using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
 using UnityEngine;
 
 public class hithandstest : MonoBehaviour
 {
     GameObject hud;
     public bool hit = false;
     public string myname;
 
     // Start is called before the first frame update
     void Start()
     {
         
     }
 
     // Update is called once per frame
     void Update()
     {
         hud = GameObject.FindGameObjectWithTag("hud");
     }
    
     void OnTriggerStay(Collider other)
     {
         if (other.tag == "Player")
         {
            if (OVRInput.GetDown(OVRInput.Button.One))
            {
           
                 myname = other.name;
                 hit = true;
 
            }
             else
             {
               
                 hit = false;
             }
        
         }
     }
     void OnTriggerExit(Collider other)
     {
         if (other.tag == "Player")
         {
             myname = "";
             hit = false;
           
         }
     }
     }
 ------------------------------------------------------------------------------------------------------------
 this is 0
 B_M/
 Magic Missile
 B_M/Y_R/B_L/B_M/
 name
 B_U/B_U/B_D/B_D/B_L/B_R/B_L/B_R/G_M/R_M/B_M/
 bryce
 

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Drfox80 · Jul 24, 2020 at 10:21 PM 0
Share

ok, I found out what wrong but don't know who to fix it fists it has hides letter magicsetom[x] so if you look magicsetom[1].Length is 6, not 4 so even if you keep that in $$anonymous$$d it still does not work so never use text in a string if some can find out what were I went wrong plz let me know thanks

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

229 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Ui text to string ? 1 Answer

Distribute terrain in zones 3 Answers

How to Instantiate from correct Icon. 1 Answer

Delaying Physics Calculations (Friction) 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges