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 Matthew 5 · Mar 16, 2011 at 04:39 AM · androidiphonedynamicbce0120

Android / iPhone deployment..

hey guys, i beleive im having an issue with dynamic typing... but i'm not savvy enough to work out the issue?

Player.transform.GetComponent("PlayerControl").RegainHealthCount = 0;
MaxHealth = Player.GetComponent("PlayerControl").Health; //Setting the maximum health value

i have other calls simular to the top one and i use;

(myObject.GetComponent(MeshFilter) as MeshFilter).mesh;

..too make it static... but with the RegainHealthCOunt.. it causes a permission error? BCE0120

and i have no idea how to change the max health = ect to work?..

If its a simple thing, im sorry, im still learning and will helpily read up on what it is, just if i could be pointed in the right direction would be awesome.

Thank you all.

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

2 Replies

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

Answer by ina · Mar 16, 2011 at 04:47 AM

Try GetComponent.<MeshFilter>().mesh etc

Comment
Add comment · Show 3 · 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 Matthew 5 · Mar 16, 2011 at 05:13 AM 0
Share

Player.transform.GetComponent.().RegainHealthCount = 0;

i tried this, i get that same permission error?

avatar image Matthew 5 · Mar 16, 2011 at 05:18 AM 0
Share

though... i switched to Windows platform.. and that permission error arrises there AND mobile platforms? thats new

avatar image Matthew 5 · Mar 18, 2011 at 12:59 AM 0
Share

the code you gave wasnt the problem, it was the fact i set the variable as Private... my bad!... so this would have worked.. BUT.. would be like my previous versions, constantly calling the script...

avatar image
0

Answer by Matthew 5 · Mar 18, 2011 at 12:57 AM

Hey guys... well... i worked out it wasn't a dynamic typing issue.. well it would of been without hte change... BUT... i found a more effcient way of dealing with it, without constantly calling for the script...

var name: SriptName;

function DoSomething () { name.Health += 20; }

works a treat.

ALSO!... the permission error BCE0120... MAKE SURE THE VARIABLE YOUR TRYING TO CHANGE ISN'T A Private variable!!! my bad! lol

hope this helps someone!

Matty

BUT this hasn't yet solved the issue with;

MaxHealth = Player.GetComponent("PlayerControl").Health; //Setting the maximum health value

...any ideas?

UPDATE

Alright!.. update!... the;

MaxHealth = Player.GetComponent("PlayerControl").Health; //Setting the maximum health value

Wasn't the issue, it was the calls from within the script...

so i converted this; Player.GetComponent("PlayerControl").Health > 0

to this; Player.GetComponent.<PlayerControl>().Health > 0

worked perfect... don't know why though? why what is the difference between these two?

matty.

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

How can i set up a 2d game for iphone/android. 2 Answers

Sending Mobile Email via Unity 2 Answers

Massive Touch Lag on mobile devices? 3 Answers

Detecting Touch on Iphone and Android 1 Answer

AWS .NET SDK on iPhone 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