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 /
This question was closed Jan 11, 2014 at 09:08 PM by z3nth10n for the following reason:

Question is off-topic or not relevant

avatar image
0
Question by z3nth10n · Jan 08, 2014 at 04:56 PM · c#call

Call JS variables and functions from C#??

Hi,

I download that: http://www.41post.com/1935/programming/unity3d-js-cs-or-cs-js-access

And the example works... So, I created a new project, and I create a new folder call Standard Assets on the Assets folder, and I created a new file call JSTest, and outside another file CSTest...

In the CSTest:

 using UnityEngine;
 using System.Collections;
 
 public class CSTest : MonoBehaviour {
 
     private JSTest Tester;
 
     // Use this for initialization
     void Start () {
         Tester = this.GetComponent<JSTest>();
     }
     
     // Update is called once per frame
     void Update () {
     
     }
 }


But inmediatly the JSTest turns red (because it wasn't found), and the following warning appear:

 Assets/CSTest.cs(6,24): warning CS0414: The private field `CSTest.Tester' is assigned but its value is never used

What can I do??

Thanks in advance. Bye.

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

  • Sort: 
avatar image
1
Best Answer

Answer by legion_44 · Jan 08, 2014 at 05:02 PM

This warning mean that You have declared variable but You newer used it. It's not an error so code should work fine.

If you using Visual Studio(i'm using 2012, don't know for rest versions) for coding, it will always mark this as error, because it's not recognizing JS scripts (so You can't access them).

Hope that helps, Paul

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 z3nth10n · Jan 08, 2014 at 05:08 PM 0
Share

I know what that warning mean, and I use $$anonymous$$onoDevelop, but why in the example that works??

Follow this Question

Answers Answers and Comments

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How Do I Update a cSharp script var from js? 2 Answers

Switching multiple cameras 0 Answers

How do i call a variable from another script? 1 Answer

Change static variable in JS through Csharp 1 Answer

[C#] PlayerRelativeControl conversion errors 0 Answers


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