1
2
3
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
fragmentManager.beginTransaction().remove(CalendarFragment.this).commit();
fragmentManager.popBackStack();
cs

 

참고 : https://m.blog.naver.com/PostView.nhn?blogId=tpgns8488&logNo=220603850137&proxyReferer=https%3A%2F%2Fwww.google.com%2F

 

Android Studio Fragment 종료 및 이전 페이지 돌아가기

작업 하다가 완료 버튼을 누르고 현재 Fragment를 없애고 이전 Fragment로 돌아갈 때 사용한다. Fragmen...

blog.naver.com

 

+ 현재 내가 사용하는 코드

1
2
3
4
5
6
7
8
9
10
11
    private void removeFragment(Fragment fragment) {
        if (fragment != null) {
            FragmentManager mFragmentManager = getActivity().getSupportFragmentManager();
            final FragmentTransaction mFragmentTransaction = mFragmentManager.beginTransaction();
            mFragmentTransaction.remove(fragment);
            mFragmentTransaction.commit();
            fragment.onDestroy();
            fragment.onDetach();
            fragment = null;
        }
    }
cs
1
2
        floatingActionButton.setImageResource(R.drawable.f_btn_map)
 
cs

시작하는 스크립트에 추가

1
2
3
4
void Start ()
    {
        Screen.orientation = ScreenOrientation.LandscapeLeft;
    }
cs

'개발 > Unity' 카테고리의 다른 글

[Unity] open android app intent  (0) 2020.12.15
[Unity] 3D 오브젝트를 캔버스에 위치시키기  (0) 2020.10.13
[Unity] cannot click button  (0) 2019.05.23
[Unity] UICamera  (1) 2019.05.22
[Unity] menu SetActive(true/false) set toggle  (1) 2019.05.22

1. graphics - raycastTarget - true 확인.

2. button - interactable 확인.

3. 버튼의 부모 객체에 graphicRaycaster 있나 확인.

4. Hierachy 에 EventSystem 있나 확인....!!!

'개발 > Unity' 카테고리의 다른 글

[Unity] 3D 오브젝트를 캔버스에 위치시키기  (0) 2020.10.13
[Unity] set screen orientation  (0) 2019.05.24
[Unity] UICamera  (1) 2019.05.22
[Unity] menu SetActive(true/false) set toggle  (1) 2019.05.22
[Unity] occlusion culling  (0) 2019.05.16

1. Camera추가 -> UICamera 로 이름 변경.

2. UICamera를 아래와 같이 설정한다.

3. UI menu를 아래오 ㅏ같이 설정한다.

 

+) 4. UICamera의 Inspector에서 Depth를 MainCamera의 앞에 위치하도록 설정한다.

 

버튼을 눌러 토글로 UI 메뉴를 active/deactive 변경하기.

 

1. 버튼들 생성.

 

 

2. <MenuOpen.c#> 스크립트 생성.

 - 여기서 추가되는 gameObject는 버튼이 눌렸을때 visible/invisible 되는 하위 버튼들임. 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
public class MenuOpen : MonoBehaviour {
 
    public GameObject mainButton;
    public GameObject reStartButton;
 
    public void showMenu()
    {
        bool isActive = mainButton.activeSelf;
 
        mainButton.SetActive(!isActive);
        reStartButton.SetActive(!isActive);
    }
 
}
cs

 

 

3. 버튼(visible/invisible 의 기준이 되는 버튼)에 스크립트 추가 후 아래와 같이 설정.

 

 

4. 하위 버튼들 deActive 설정.

 

끗!!

 

 

 

 

 

결과물

 

 

 

참고 : https://youtu.be/LziIlLB2Kt4

Activity class does not exist

안드로이드 기기를 컴퓨터와 연결한 상태에서 해당 앱을 삭제하면 나타나는 현상.

앱정보-> 사용중지 앱 에서 해당 앱을 제거 하면 된다.

* occlusion culling : 카메라의 FOV(Field of view) 외에 있는 모든 객체들을 제거하여 하드웨어에 무리가 가지않게 설정.

1) Window-Occlusion Culling

2) 대상 객체 선택 후 Static 설정

3) 각 객체마다의 Occluder 크기를 설정하고 (작을수록 미세조정) 하단의 Bake버튼 클릭

4) Scene Filter 설정 

+ Recent posts