c# - How to access enum in Unity AndroidJavaClass -
i'm newbie unity. have android project in eclipse , java class test
inside package com.mytestcode
. in test there nested class test.login
login
enum defined enum login {app, web, app_web}
. in eclipse, can run fine;
package com.mytestcode; import com.mytestcode.test; ... public testmethod(test.login abc) { if(test.login.app == abc){ // } }
come unity, have come these errors
androidjavaclass test = new androidjavaclass("com.mytestcode.test"); //work fine androidjavaclass test2 = new androidjavaclass("com.mytestcode.test.login"); //return classnotfound error androidjavaobject test3 = new androidjavaclass("com.mytestcode.test.login"); //return nosuchfielderror error androidjavaobject test4 = test.getstatic<androidjavaobject>("login.app"); //return nosuchfielderror error androidjavobject test5 = test.getstatic<androidjavaobject>("test.login.app") //return nosuchfielderror error
how can access values in enum test.login ?
thank you.
my first thought enums not directly convertible.. test this:
//create new enum in own class , test androidjavaclass test6 = new androidjavaclass("com.mytestcode.login"); androidjavobject test7 = test6.getstatic<androidjavaobject>("login.app");
i started on java-android heavily using enums hold lots of data , when got on c#-unity, realised c# doesn't provide enum-"class-type"
so advise convert enum int until start new project directly on c#
Comments
Post a Comment