오류 CS0433 'Task' 형식이 'Unity.Tasks, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' 및 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'에 모두 있습니다.
[해결방법]
/Parse/Plugins 아래에서 안쓰는 버전의 Unity.Compat, Unity.Tasks 제거
(.NET 4.x 버전을 쓰고 있어서 .NET 3.5 버전 Unity.Compat, Unity.Tasks 제거함)
Using the shortcutAlt + 'or theHelp -> Quick Searchmenu will bring out the Quick Search Tool. This extensible tool allows you to search over multiple area of Unity.
It is easy to add new search providers to the Quick Search Tool (see API section below), by default we ship with theseSearchProviders:
Assets
All assets in the current project are available for search. From an asset you can apply the following actions:
Select the asset (in the Project browser)
Open the asset (using an external editor if necessary)
Show in Explorer (Finder)
Asset provider supports advance type filtering (Similar to Project Hierarchy):
Current Scene
All GameObjects in the current scene are available for search. Activating a scene item in the Quick Search tool will select the corresponding GameObject in the Scene.
Menu
Each menu items in Unity is available for search. You can execute the menu item from the Quick Search Tool. This is especially useful to pop that elusive Test Runner or the Profiler!
Settings
Each Project Settings or Preferences pages is available for search. The Quick Search Tool will open the Unified Settings Window at the required pages.
Online Search Providers
We have aSearchProviderthat allows to search various Unity websites. Using this provider will open your default browser at a specific Unity page and perform a search and display some results. You can search the following websites and it is very easy to add new web search providers:
All the features of the Quick Search tool can be access using the keyboard:
The Search box is always focused and you can type even with an element selected.
Alt + Left Arrow: Toggle the Filter view
UsingUp Arrow,Down Arrowin the Filter view cycle between filters.
Usingspacebartoggle a filter
Alt + Right Arrowbrings the action menu
Alt + Up ArroworAlt + Down Arrownavigate through the search history:
Filters
There are 2 levels of filtering available in the Quick Search Tool:
Provider filters
Those filters define which providers are available for a search. This can help reduce the amount of items return by a search query especially if you know what type of item you are looking for.
Note that there are more specialized shortcuts to call the Quick Search Tool with a specific provider filter enabled:
Alt + Shit + A: Assetsonlysearch
Alt + Shit + M: Menuonlysearch
Alt + Shit + S: Sceneonlysearch
Provider text filters
From the Quick Search Box you can type a searchprovider search filter tokenthat will restrain the search to specific providers. The search tokens are:
Asset:p:
Menu:me:
Scene:h:
Online Search:web:
Example of queries using text providers:
p:Player: Search assets containing "Player"
h:Main Camera: Search scene for GameObjects with "Main Camera" in their name
me:Test Runner: Search menus item for Test Runner
se:VFX: Search settings (project and preferences) for VFX
Provider specific filters
Some provider (i.e the Asset provider) supports specific filters:
As usual you can pass the same search tokens used by the project browser to a search query:
Last Search
When opening the Quick Search Tool usingAlt + `the state (and filters) of your previous search is preserved:
Drag and Drop
Asset items and Scene Items supports drag and drop from the QuickSearch window to anywhere that supports it (hierarchy view, game view, inspector, etc):
API
Creating newSearchProvideris fairly easy. It basically comes down to providing a function to fetch and search for items and to provide action handlers toactivateany selected item.
SearchProvider
AnSearchProvidermanages search for specific type of items and manages thumbnails, description and subfilters. Its basic API is as follow:
public class SearchProvider
{
public SearchProvider(string id, string displayName = null);
// Create an Item bound to this provider.
public SearchItem CreateItem(string id, string label = null, string description = null, Texture2D thumbnail = null);
// Utility functions use to check if a search text matches a string.
public static bool MatchSearchGroups(string searchContext, string content);
public static bool MatchSearchGroups(string searchContext, string content, out int startIndex, out int endIndex);
public NameId name;
// Text filter key use to enable this Provider from the NameId search box
public string filterId;
// Functor used to fetch item description
public DescriptionHandler fetchDescription;
// Functor used to fetch thumbnail icon
public PreviewHandler fetchThumbnail;
// Functor used to execute a search query
public GetItemsHandler fetchItems;
// Functor use to check if an item is still valid
public IsItemValidHandler isItemValid;
// Sub filter specific to this provider
public List<NameId> subCategories;
// Called when QuickSearchWindow is opened allowing a provider to initialize search data.
public Action onEnable;
// Called when QuickSearchWindow is closed.
public Action onDisable;
}
Note that since the UI of the NameId is done using avirtual scrolling algorithmsomeSearchItemfields (thumbail and description) are fetched on demand. This means theSearchProviderneeds to be initialized with specificHandlers(fetchDescription, fetchThumbnail) if you want to populate those fields.
Registering an SearchProvider
Adding a newSearchProvideris just creating a function tagged with the[SearchItemProvider]attribute. This function must returns a newSearchProviderinstance:
By default anSearchProvidermust have a type (ex: asset, menu, scene...) that is unique among providers and a display Name (used in the Provider filter dialog).
Specifying afilterIdis optional but it makestext based filteringeasier (ex:p: my_asset).
Performing a search
The bulk of the provider work happens in thefetchItemsfunctor. This is the function a provider creator must fulfill to do an actual search (and filtering). ThefetchItemssignature is:
// context: all the necessary search context (tokenized search, sub filters...)
// items: list of items to populate
// provider: the provider itself
public delegate void GetItemsHandler(SearchContext context, List<SearchItem> items, SearchProvider provider);
TheSearchProvidermust add newSearchItems to theitemslist.
AnSearchItemis a simple struct:
public struct SearchItem
{
// Unique id of this item among this provider items.
public string id;
// Display name of the item
public string label;
// If no description is provided, SearchProvider.fetchDescription will be called when the item is first displayed.
public string description;
// If no thumbnail are provider, SearchProvider.fetchThumbnail will be called when the item is first displayed.
public Texture2D thumbnail;
}
Only theidis necessary to be filled.
When doing filtering according toSearchContext.searchTextwe recommend using the static functionSearchProvider.MatchSearchGroupwhich makes partial search (and eventually fuzzy search) easy (see example above).
Asynchronous Search Results
If your search providers can take a long time to compute its results or rely on asynchronous search engine (ex: WebRequests) you can use thecontext.sendAsyncItemscallback to populate search results asynchronously.
TheSearchContextalso contains asearchIdthat needs to be provided with the call tosendAsyncItems. This allows QuickSearch to know for which search those results are provided.
An example of using asynchronous search result would be:
new SearchProvider(type, displayName)
{
filterId = "store:",
fetchItems = (context, items, provider) =>
{
var currentSearchRequest = UnityWebRequest.Get(url + context.searchQuery);
currentSearchRequest.SetRequestHeader("X-Unity-Session", InternalEditorUtility.GetAuthToken());
var currentSearchRequestOp = currentSearchRequest.SendWebRequest();
currentSearchRequestOp.completed += op => {
var items = // GetItems from websearch
// Notify the search about async items:
// ensure to set the searchId you are providing result for!
context.sendAsyncItems(context.searchId, items);
};
}
};
The QuickSearch package contains 2 examples with async results:
com.unity.quicksearch/Editor/Providers/Examples/AssetStoreProvider.cs: which provide a way to query the asset store using WebRequest.
com.unity.quicksearch/Editor/Providers/Examples/ESS.cs: which creates a thread to start the EntrianSource search indexer to provide full text search for assets in your project.
Registering an Action Handler
Actions can be register for a specific provider. These actions buttons will be drawn next to theSearchItemof the specified provider type:
Since registering an action handler is a different process than regisering a provider this means you can register new action handlers for existing providers (mind blown)!
Here is an example of how to register actions for the Asset provider:
Basically you create a function tagged with the[SearchActionsProvider]attribute. This function must returns anIEnumerable<SearchAction>.
AnSearchActiondescribe and action and provide a handler to execute the action on a specificSearchItem
public class SearchAction
{
public SearchAction(string providerType, string name, Texture2D icon = null, string tooltip = null);
public ActionHandler handler;
public EnabledHandler isEnabled;
}
providerTypeis the provider unique id for which you are registering the action.
ActionHandleris of the following signature:
// item: item that needs the action to be executed.
// context: search context of the SearchTool when the item is executed.
public delegate void ActionHandler(SearchItem item, SearchContext context);
An action can be setup with aisEnabledpredicate that will decide if the action is available (i.e. enabled) for a specific item.
SearchService
TheSearchServicemanages most of the persisted state of the Quick Search Tool and provider a global end point to access the filter.
The common usage of theSearchServiceforSearchProviderwriter is to register a shortcut that will open the Quick Search Tool with a specific set of filter enabled:
[Shortcut("Window/Quick Search Tool/Assets", KeyCode.A, ShortcutModifiers.Alt | ShortcutModifiers.Shift)]
public static void PopQuickSearch()
{
// Disable all filter
SearchService.Filter.ResetFilter(false);
// Enabled only the asset SearchProvider
SearchService.Filter.SetFilter(true, "asset");
// Disabled the packages sub filter
SearchService.Filter.SetFilter(false, "asset", "a:packages");
// Open the Quick Search Tool to allow a quick search of assets!
SearchTool.ShowWindow();
}
Unity 2020.3.21f1에서 Unity 2020.3.22f1으로 업데이트 하고나니 Android는 문제없는데, iOS에서 기존에 발생하지 않던 쉐이더 문제가 생겼다.
[증상] 기존에 검은 느낌이던 텍스쳐가 약간 회색빛이 나옴
그래서 Unity 2020.3.21f1으로 내리니 다시 정상동작 하는걸 확인했다.
링크 내용을 보니 iOS Dark Mode 관련 버그라고 한다.
현재 임시로 해결하는 방법은 iOS Info.plist에서 강제로 Dark Mode로 셋팅 하는 방법이 있다고 한다.
버그가 수정될 때까지 Dark Mode로 셋팅하거나, Unity 2020.3.21f1 이하 버전을 사용해야 될 것 같다.
[Unity 소스상에서 Info.plist 수정]
var projectPath = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.pbxproj";
var plistPath = System.IO.Path.Combine(pathToBuiltProject, "Info.plist");
var plist = new PlistDocument();
plist.ReadFromFile(plistPath);
// [iOS15+Unity2020.3.22f1 이슈] Force Dark Mode(Automatic/Light/Dark) - Appearance
plist.root.SetString("UIUserInterfaceStyle", "Dark");
Now, to save the object you'll have to usethis.DontDestroyOnLoad();instead of the normalDontDestroyOnLoad(this);
EDIT:
I started looking into this and found that setting a GameObject's hideflags toHideFlags.DontSavemeans (as far as I can tell) the same thing as DontDestroyOnLoad, except that none of Unity's functions (Update, etc.) are called. The one with hideflags might also leak if not destroyed manually...
Finding GameObjects with its hideFlags set to DontSave is trivial.