I have a Player and a Mob gameobject. I want to get the Player's Target component to the Mob's PTarget. My player's script what does the targeting is called "Targeting". How can i acces this?
May 06 '12 at 07:01 PM
I didn't downvote your question, but... this is a joke, right?
Under the Mob's script you can use the following (c#):
Transform PTarget = GameObject.Find("PlayerObjectName").GetComponent(typeof(Transform)) as Transform;
May 06 '12 at 07:49 PM
May 06 '12 at 07:22 PM
Just want to say that this:
.GetComponent(typeof(Transform)) as Transform
is the same as
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
Once you sign in you will be able to subscribe for any updates here
Answers and Comments
The best place to ask and answer questions about development with Unity. Check out our FAQ for more information.
To help users post good questions and use the site effectively we have posted a tutorial video. Please check it out.
asked: May 06 '12 at 07:01 PM
Seen: 362 times
Last Updated: May 06 '12 at 07:54 PM
Ease in transform.LookAt() - keep other target within camera boundaries
target and look at random enemies
Move object to several locations
Object as far Z as it can
if object is destroyed
getcomponent' is not a member of 'object'
Removing objects from an array
How to make an object to look at Raycast Hit Point?
Howto access a variable in another script?