When the Type of `AlternateIcon` is set to Auto Generate, the icon will be automatically resized at build time, so there is nothing to worry about. (The maximum size is 1024px.) If you want to control it in detail, you can change the Type to Manual.
## Requirements - Unity 2020.3 or higher. - Xcode 13 or higher.
nameTranslation.txt 파일을 상대경로(파일명만)로 지정했을 때 제대로 생성하지 못하는 문제가 있어서 우회하도록 수정함.
BuildReport에서 주는 빌드파일 경로를 쓰지 않고, string.Format(@"{0}/..", Application.dataPath) 로 프로젝트 패스를 쓰도록 변경함.
해당 방식을 쓰기위해 Android 일 때만, Obfuscator의 OptionsManager.cs의 LoadAssetAtPath 함수를 아래와 같이 일부 수정했다.
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
namespace Beebyte.Obfuscator
{
public class OptionsManager
{
....
private static Options LoadAssetAtPath(string path)
{
// [Android] nameTranslationFile Path 변경
if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android)
{
// Custom
Options o = AssetDatabase.LoadAssetAtPath<Options>(path);
if (o == null)
{
return null;
}
// 옵션값 덮어쓰지 않도록 Clone해서 사용.
var clone_o = Object.Instantiate(o);
/// 현재 프로젝트 절대 경로(Application.dataPath/../)로 수정 반환
// 파일명(Default:nameTranslation.txt)만 추출해서 저장
string strnameTranslation = System.IO.Path.GetFileName(clone_o.nameTranslationFile);
// 현재 프로젝트 Path 적용. 절대경로값 지정
clone_o.nameTranslationFile = string.Format(@"{0}/../{1}", Application.dataPath, strnameTranslation);
return clone_o;
}
// [iOS] 기존 방식
else
{
// Original
return AssetDatabase.LoadAssetAtPath<Options>(path);
}
}
....
}
}
----
Obfuscator에 난독화 기능을 쓸 때,
난독화 전/후 Naming 매칭 리스트를 뽑아주는 옵션이 있다.(아래 스샷 참조)
ObfuscatorOptions.asset
체크하면 기본 파일명이 nameTranslation.txt인데 빌드 할 때마다 덮어버리니 관리가 안돼서 빌드마다 별도로 만들어질 수 있도록 PostProcess로 파일명을 Rename 하도록 처리했다.
아래 소스를 프로젝트에 추가하면,
[Android] namteTranslation.txt 파일을 빌드 파일명에 매칭해서 자동으로 변경해준다.
ex) 빌드 파일명 : abc_v1.0.0.apk
변경되는 파일명 : abc_v1.0.0.apk_ namteTranslation.txt
[iOS] iOS는 빌드 시점에 파일명이 지정되는게 아니라서 별도의 조합으로 진행되도록 했다.
WARNING:/Users/{UserAccount}/.gradle/caches/transforms-2/files-2.1/ea30c3c071cd48c926311878c13eb08b/jetified-unity-classes.jar: D8: Expected stack map table for method with non-linear control flow.
그래서 아래 위치의 gradle cache 하위 있는 것들을 모두 삭제하고 새로 빌드를 실행해서 잘 돌아가는 것을 확인했다.
Ever stuck on how to render a video on a TV screen in a game? Lets us learn the concept of playing a video in Unity.
You can import many different formats of video file into Unity. Unity stores such imported video files as VideoClip assets. A Video Clip is an imported video file, which the Video Player component uses to play video content. The playing video also accompanies audio content, if it has any. Typical file extensions for video files include .mp4, .mov, .webm, and .wmv.
To check the video file compatibility in unity, clickhere.
The Video Player component
Video Player componentis used to attach video files to GameObjects, and play them on the GameObject’s Texture at run time.
By default, the Material Property of a Video Player component is set to MainTex, which means that when the Video Player component is attached to a GameObject that has a Renderer, it automatically assigns itself to the Texture on that Renderer (because this is the main Texture for the GameObject).
You can also set the following specific target for the video to play on, using theRender Modeproperty of Video Player:
A Camera plane
A Render Texture
A Material Texture parameter
Any Texture field in a component
Playing a video already in Assets
If you already have a video clip in your asset folder, you can simply set theSourceproperty of Video Player component toVideo Clipand drag and drop your video clip in the inspector. Alternatively, you can set the video clip in script usingclipproperty.
public VideoPlayer myVideoPlayer;
public VideoClip myClip;
myVideoPlayer.clip = myClip;
You can tick the propertyPlay On Awakeif you want to play the video the moment the Scenelaunches. Otherwise you can trigger the video playback withPlay()command at another point during run time.
myVideoPlayer.Play();
Playing Video from url in Unity
You might be having a video on server which you want to load on runtime. Here is how we can do it:
Here, we have waited till the video player successfully prepared the content to be played.
Note, the url can also contain the path of the file.
Downloading and Saving Video from Url
The above line of code plays the video directly from the url. Alternatively, you can download the video file and then play the video from this path. The line of code below downloads the video clip and saves it atApplication.persistentDataPath.