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
1
Question by appels · May 28, 2010 at 02:53 AM · statictargetvarsmoothfollowbce0005

set SmoothFollow target at runtime via static var

Hi,

I have a textfield in my GUI where i enter a custom name. When I instantiate my player object i change it's name to that custom name using a static var. When I debug I see it's changed, so my static var works. When i try to use that same static in my SmoothFollow script, I get this error : Assets/Standard Assets/Camera Scripts/SmoothFollow.js(9,11): BCE0005: Unknown identifier: 'ConnectionGUI'.

Anyone got an idea ? Thanks.

Eddy.

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 qJake · May 28, 2010 at 03:05 AM 0
Share

Posting your code would probably help.

3 Replies

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

Answer by appels · May 29, 2010 at 02:18 AM

Thanks everyone. I got it to work. I'm able to assign my prefab at runtime like this :

prefab = Instantiate(Resources.LoadAssetAtPath("Assets/playerPrefab.prefab", GameObject));

and attached the SmoothFollow by finding the gameobject and use it's transform. The transform is what got me confused but all sorted now.

Eddy.

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

Answer by spinaljack · May 28, 2010 at 11:36 AM

If I understand you correctly you're going about it the wrong way. You need to find the game object with GameObject.Find or better, GameObject.FindWithTag to get the instance of the object and then you can reference it's transform for the smooth follow script.

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

Answer by Ashkan_gc · May 28, 2010 at 12:25 PM

link textsmooth follow requires a transform to follow but name of an object is a string. the value of a text field is a string so you can asign it to a string but not to a transform. to find a gameObject with that name you should use GameObject.Find

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

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

No one has followed this question yet.

Related Questions

Camera Target Switch By Tag HELP! 1 Answer

getting static vars from other scenes? 2 Answers

Spawning objects on trigger does not work as expected 2 Answers

Problem with static variables 1 Answer

How to Make the SmoothFollow Script Follow Faster? 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