• 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 Naist · Aug 01, 2014 at 01:02 PM ·

Need help with code

Hey. After following the tutorial Let's clone a game [ Pokemon ] I am kinda stuck. In episode 8 he makes the script for the attributes in java. I wanted to do it in C#. I am kinda dumb when it comes to coding and it shows me the error i have to make a size for the array. In the video he didn't had to do it so i used his code for java script. but somehow the java script files i make seem not to exist. whenever i make a new js file i can modify it but when i use it on an object i get an error message saying: file does not exist and that happens with every java script i create. so now i am stuck with my c# script which does not work. hopefully someone can help me:

Script 1:

 using UnityEngine;
 using System.Collections;
 
 [System.Serializable]
 public class Monster {
 
        public string Name;
     public Type type;
     public float basehp;
     public float currhp;
     public float basead;
     public float currad;
     public float basedf;
     public float currdf;
     public float basesp;
     public float currsp;
 
 
 }
 
 public enum Type { Water, Nature, Fire, Electric, Earth}
 
 ________________________________________________________________
 Script 2:
 using UnityEngine;
 using System.Collections;
 
 public class Main {
     Monster[] Monster = new Monster[];
 
 }

I want to be able to modify the attributes in the Inspector like he does. Hope someone can help me.

Comment
Add comment · Show 5
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 meat5000 ♦ · Aug 01, 2014 at 01:14 PM 0
Share

Have you installed the JD$$anonymous$$? Not sure if it will help but it might.

Anyway, if you are writing in C# extension is cs, not js.

avatar image Naist · Aug 01, 2014 at 01:19 PM 0
Share

jdk is installed. if i make just a new script without modifying it for java then it works and i can put it on objects. i use mainly cs. still it won't work.

avatar image tanoshimi · Aug 01, 2014 at 01:44 PM 1
Share

I'm guessing you meant Javascript? Totally unrelated to Java and the JD$$anonymous$$. Like the error says, initialise the size of the array. So, if you want 10 monsters:

 $$anonymous$$onster[] $$anonymous$$onster = new $$anonymous$$onster[10];
avatar image Naist · Aug 01, 2014 at 02:08 PM 0
Share

warning CS0414: The private field `$$anonymous$$ain.$$anonymous$$onster' is assigned but its value is never used

is the warning i get. but it doesn't matter so much , or?

avatar image Kiwasi · Aug 01, 2014 at 08:05 PM 0
Share

The warning is just for efficiency. Okay to ignore while developing, should be resolved before final build.

0 Replies

· Add your reply
  • Sort: 

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

I made a better shader how do i fix[add _Shadow Strength]help???>Sorry that im asking for to much 1 Answer

Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers

UnityEngine.Input.GetMouseButton(1)) issue 1 Answer

How do I make a network? 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