public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);
            mUnityPlayer = new UnityPlayer(Activity, this);
            //View view = inflater.Inflate(R.layout.fragment_unity, container, false);
            //this.frameLayoutForUnity = (FrameLayout)view.findViewById(R.id.frameLayoutForUnity);
            //this.frameLayoutForUnity.addView(mUnityPlayer.getView(),
            //        FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);

            mUnityPlayer.RequestFocus();
            return(mUnityPlayer);
        }
Exemplo n.º 2
0
        protected UnityPlayer mUnityPlayer; // don't change the name of this variable; referenced from native code

        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                RequestWindowFeature(Android.Views.WindowFeatures.NoTitle);
                base.OnCreate(savedInstanceState);
                mUnityPlayer = new UnityPlayer(this);
                SetContentView(mUnityPlayer);
                mUnityPlayer.RequestFocus();
                Timer();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }