0

I have successfully exported my Unity Project to Android Studio. In my main activity, I have a button that when pressed, should start a Unity scene. Now what if I have multiple scenes (let's say three) and I only want to play one of them, how do I choose? This is my UnityPlayerActivity onCreate method:

protected UnityPlayer mUnityPlayer;
@Override protected void onCreate (Bundle savedInstanceState)
{
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);

    getWindow().setFormat(PixelFormat.RGBX_8888);

    mUnityPlayer = new UnityPlayer(this);
    int glesMode = mUnityPlayer.getSettings().getInt("gles_mode", 1);
    boolean trueColor8888 = false;
    mUnityPlayer.init(glesMode, trueColor8888);
    setContentView(mUnityPlayer);
    mUnityPlayer.requestFocus();

    FrameLayout layout = (FrameLayout) findViewById(R.id.frameLayout2);
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
    layout.addView(mUnityPlayer.getView(), 0, lp);
}
Paradigm
  • 159
  • 1
  • 3
  • 11

0 Answers0