• 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 Vinpasso · Feb 28, 2011 at 05:10 PM · missingfieldexception

Missing Field Exception: Field "UnityEngine.TextMesh.text" not found

Hey People, I keep getting two field not found exceptions: First one when I try to change the objects name: Missing Field Exception "UnityEngine.GameObject.name" and Secondly when i try to cast the name on the TextMesh: Missing Field Exception "UnityEngine.TextMesh.text" (Instantiator is a String Array)

Here is my code:

function Update() {
    if(Instantiator.length != 1) {
        for(var i = 0; i < Instantiator.length; i++) {
            var chara = Instantiate(Character, Vector3(10,10,10), Quaternion.identity);
            Debug.Log("Instantiated");
            chara.name = Instantiator[i];
            chara.GetComponentInChildren(TextMesh).text = Instantiator[i];
            Users.Add(chara);
            if(Login.GetNick() == Instantiator[i]) {
                Character = chara;
                Character.GetComponent("Third Person Camera").SetTarget(camera.main.transform);
                Character.GetComponent("Third Person Controller").enabled = true;
            }
            else {
                chara.GetComponent("Third Person Controller").enabled = false;
            }
            Instantiator.RemoveAt(i);
        }
    }
}

PS: I am trying to communicate between non Unity thread and Unity thread, atm i am using an array to store names and this script checking if anything needs to be instantiated, if there is a more effecient way of doing this please let me know.

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by DaveA · Feb 28, 2011 at 11:36 PM

You should type your vars:

var chara : GameObject = Instan....

and

var tm : TextMesh = chara.GetComponentInChildren(TextMesh);
tm.text = Ins....
Comment
Add comment · Show 1 · Share
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 DaveA · Mar 07, 2011 at 07:10 PM 1
Share

That's very wise

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Getting variables after Resources.LoadAll 1 Answer

ERROR: missing field exception 1 Answer

connectedBody error when used in script 1 Answer

Shader Graph Edit Parameters From Script 3 Answers

Array Error - Won't return items in array 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges