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 AaronTCF · Jan 30, 2014 at 10:14 PM · static variableaccessing scriptspragmastrictpragma strict

UnityScript static variables is not a member of a script

Unity complains that : ImportWindowUI.js(21,33): BCE0019: 'modelImported' is not a member of 'UnityEditor.ModelImporter'. ImportWindowUI.js(22,26): BCE0019: 'modelImported' is not a member of 'UnityEditor.ModelImporter'. ImportWindowUI.js(22,57): BCE0019: 'modelPending' is not a member of 'UnityEditor.ModelImporter'. ImportWindowUI.js(22,87): BCE0019: 'processingModel' is not a member of 'UnityEditor.ModelImporter'. ImportWindowUI.js(25,42): BCE0019: 'modelImported' is not a member of 'UnityEditor.ModelImporter'. ImportWindowUI.js(26,58): BCE0019: 'modelImported' is not a member of 'UnityEditor.ModelImporter'. ImportWindowUI.js(27,65): BCE0019: 'ReturnProcessedModel' is not a member of 'UnityEditor.ModelImporter'.

The errors come after I put #pragma strict. But I don't think it is an issue of dynamic typing.

In addition, I also tried to declare them as public or private variables, the compiler is still throwing the same errors.

The Script I am having problems with ImportUI script:

 #pragma strict
 
 private var modelimporter : ModelImporter = (GameObject.Find("Browser").GetComponent(ModelImporter) as ModelImporter);
 
 private var menuExpanded : Boolean = false;
 private var processedModels : GameObject[];
 private var typeButton : int = 0;
 public var typeTexture : Texture[];
 
 public var skin : GUISkin;
 public var background : Texture2D;
 public var typeBackground : Texture2D;
 
 function OnEnable () {
     Debug.Log("ImportWindowUI log : Enabled");
 }
 
 function OnGUI () {
     var tempSkin : GUISkin = GUI.skin;
     GUI.skin = skin;
     Debug.Log(ModelImporter.modelImported);
     if(ModelImporter.modelImported || ModelImporter.modelPending || ModelImporter.processingModel) {
         Debug.Log("ImportWindowUI log : ModelImporter alert");
         if(GUI.Button(Rect(15, 15, 40, 40),"buildingButton")) {
             if(ModelImporter.modelImported) menuExpanded = !menuExpanded;
             if(menuExpanded && ModelImporter.modelImported) {
                 processedModels = modelimporter.ReturnProcessedModel();
             }
         }
         if(menuExpanded && processedModels.length > 0) {
             GUI.BeginGroup(Rect(15, 55, 150, processedModels.length * 50));
                 var gameobjectArray : GameObject[] = processedModels;
                 for(var i = 0; i < gameobjectArray.length; i++) {
                     if(GUI.Button(Rect(0, i*50, 150, 50), gameobjectArray[i].name)) {
                         typeButton = GUI.SelectionGrid(Rect(150, i*50, 200, 50), typeButton, typeTexture,3);
                         if(GUI.Button(Rect(350, i*50, 50, 50), "tick")) {
                             Debug.Log("ImportWindowUI log : typeButton = " + typeButton);
                         }
                     }
                 }
             GUI.EndGroup();
         } else if (processedModels.length == 0) {
             menuExpanded = false;
         }
     }
 }
 

and below is the ModelImporter Script:

 #pragma strict
 
 import System.IO;
 
 static var modelPending : Boolean = false;
 static var modelImported : Boolean = false;
 static var processingModel : Boolean = false;
 
 private var modelPaths : Array = new Array();
 private var processedModel : Array = new Array();
 private var model : GameObject;
 
 function Update () {
     if(modelPaths.length > 0 && !processingModel) {
         ImportModel(modelPaths.Shift());
     }
     if(processedModel.length > 0) {
         modelImported = true;
     } else {
         modelImported = false;
     }
     if(modelPaths.length > 0) {
         modelPending = true;
     } else {
         modelPending = false;
     }
 }
 
 private function ImportModel (path : String) {
     processingModel = true;
 
     if (Path.GetExtension(path) == ".obj") {
         // do stuff and return;
     } else if(Path.GetExtension(path) == ".dae") {
         //do stuff and return;
     } else {
         Debug.Log("ModelImporter log : Cannot process 3D model with extension = " + Path.GetExtension(path));
         // return;
     }
 }
 
 public function PostProcessModel (message : String) {
         processedModel.Push(model);    
         processingModel = false;
 }
 
 public function AddModelPaths (path : String) {
     modelPaths.Add(path);
 }
 
 public function ReturnProcessedModel () : GameObject[] {
     return (processedModel.ToBuiltin(GameObject) as GameObject[]);
 }
 


Any suggestions would be much appreciated..

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 roojerry · Jan 30, 2014 at 10:22 PM

You probably want to change the name of your ModelImporter class. Unity already has a ModelImporter defined.

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 AaronTCF · Jan 30, 2014 at 10:40 PM 0
Share

Thank you so much $$anonymous$$. I hope you could feel the hug I did to the monitor.

avatar image
0

Answer by AaronTCF · Jan 30, 2014 at 11:16 PM

Thank you so much Brian. I hope you could feel the hug I did to the monitor!

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

20 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 avatar image

Related Questions

To count deaths with global variable 1 Answer

pragma strict on a editor script. 1 Answer

Singleton and multiple scene data 1 Answer

How to access other scripts from one script 0 Answers

Custom Editor Access to Scene Objects Variables (in the same way as UnityEvents) 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