- Home /
Needing to get communication between two c# scripts.
So I'm currently working on a project that needs to have two c# scripts interact with one another. I have a script that changes the texture of a Gui Texture based on the player's health, which is a script of its own. This is the code I have for now that calls it.
if(GetComponent<PlayerHealth>().health >= 4)
I've tried having the health int being a Public Static int but that messes up another script. So what am I doing wrong and how can I fix this? Let me know if you want to see the whole code.
Yes, please post your whole code. $$anonymous$$ost of the experienced users can sit here and tell you all the different ways you can go about doing this, but seeing how you're trying to do it so that we can guide you through the correct manner would be more appropriate.
Answer by sparkzbarca · Apr 18, 2013 at 05:15 PM
that code is right. Presumably the
health in the script
PlayerHealth isn't public
that should work if you have a script called PlayerHealth
with a
Public Int health;
Your answer
Follow this Question
Related Questions
Problem web service / standalone 1 Answer
Can't get SendMessage in webpage to send info to the web player 1 Answer
How do I use Yield in C#? 3 Answers