- Home /
how to make unity work in android fragment
Hello I'm developing a unity android application and it was working within native android application as a seperate activity.But now my customer wants to show unity view in a android fragment . Is something like that possible. If it is how can I do that I was using the below code to show unity view in android activity. What should I change?
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
unityPlayer = new UnityPlayer(this);
int settingInt = unityPlayer.getSettings().getInt("gles_mode", 2);
unityPlayer.init(settingInt, false);
View v = unityPlayer.getView();
setContentView(v);
v.requestFocus();
String coordinates = globals.deviceLocation.getLatitude()+","+globals.deviceLocation.getLongitude();
UnityPlayer.UnitySendMessage("Main Camera","setCurrentCoordinateToUnity",coordinates);
}
Thanks Tolga
@tolgatanriverdi - did you get this working? If so, can you share how you made it work?
I don't know the answer, but I'd love to help resolve this. $$anonymous$$y setup: Unity app embedded in an Android fragment (Unity 5.3.2f1 Personal edition, Android Studio 1.5.1); the contents of the fragment appear black.
Unity folks: I'd be happy to help resolve this and write up a tutorial on it, but I need some help just getting it to work. Help! (please)
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Android Plugin | How to get FragmentManager from currentActivity 1 Answer
Camera 2D Movement android unity 1 Answer
Question about Network and NetworkViewID 1 Answer
Android Tutorial 2 Answers