CRYPTO NEWS

Error CS1061 unity how to fix the error? Blockchain Game using Moralis, Unity, C#

When transferring the files of this project to another project, I got two errors:(

The first: AssetsNFTThirdPartyNavMeshComponentsEditorNavMeshAssetManager.cs(44,73): CS1061 error: ‘PrefabStage’ does not contain a definition for ‘assetPath’ and could not find an available ‘assetPath’ extension method that accepts the first argument of type ‘PrefabStage’ (are you missing a using directive or an assembly reference?)

The second: AssetsNFTThirdPartyNavMeshComponentsEditorNavMeshAssetManager.cs(46,81): CS1061 error: ‘PrefabStage’ does not contain a definition for ‘assetPath’ and an available ‘assetPath’ extension method could not be found that accepts the first argument of type ‘PrefabStage’ (are you missing a using directive or an assembly reference?)

Screenshot of the error code: enter image description here

If you need the project itself, then here is the link: https://github.com/MoralisWeb3/youtube-tutorials/releases/tag/v1.0.1-unity-web3-spaceFPS

Code:

using System.Collections.Generic; using System.IO; using UnityEditor.Experimental.SceneManagement; using UnityEditor.SceneManagement; using UnityEngine.AI; using UnityEngine;  namespace UnityEditor.AI {     public class NavMeshAssetManager : ScriptableSingleton<NavMeshAssetManager>     {         internal struct AsyncBakeOperation         {             public NavMeshSurface Surface;             public NavMeshData BakeData;             public AsyncOperation BakeOperation;         }          List<AsyncBakeOperation> m_BakeOperations = new List<AsyncBakeOperation>();         internal List<AsyncBakeOperation> GetBakeOperations() { return m_BakeOperations; }          struct SavedPrefabNavMeshData         {             public NavMeshSurface Surface;             public NavMeshData NavMeshData;         }          List<SavedPrefabNavMeshData> m_PrefabNavMeshDataAssets = new List<SavedPrefabNavMeshData>();          static string GetAndEnsureTargetPath(NavMeshSurface surface)         {             // Create directory for the asset if it does not exist yet.             var activeScenePath = surface.gameObject.scene.path;              var targetPath = "Assets";             if (!string.IsNullOrEmpty(activeScenePath))             {                 targetPath = Path.Combine(Path.GetDirectoryName(activeScenePath), Path.GetFileNameWithoutExtension(activeScenePath));             }             else             {                 var prefabStage = PrefabStageUtility.GetPrefabStage(surface.gameObject);                 var isPartOfPrefab = prefabStage != null && prefabStage.IsPartOfPrefabContents(surface.gameObject);                 if (isPartOfPrefab && !string.IsNullOrEmpty(prefabStage.assetPath))                 {                     var prefabDirectoryName = Path.GetDirectoryName(prefabStage.assetPath);                     if (!string.IsNullOrEmpty(prefabDirectoryName))                         targetPath = prefabDirectoryName;                 }             }             if (!Directory.Exists(targetPath))                 Directory.CreateDirectory(targetPath);             return targetPath;         }          static void CreateNavMeshAsset(NavMeshSurface surface)         {             var targetPath = GetAndEnsureTargetPath(surface);              var combinedAssetPath = Path.Combine(targetPath, "NavMesh-" + surface.name + ".asset");             combinedAssetPath = AssetDatabase.GenerateUniqueAssetPath(combinedAssetPath);             AssetDatabase.CreateAsset(surface.navMeshData, combinedAssetPath);         }          NavMeshData GetNavMeshAssetToDelete(NavMeshSurface navSurface)         {             if (PrefabUtility.IsPartOfPrefabInstance(navSurface) && !PrefabUtility.IsPartOfModelPrefab(navSurface))             {                 // Don't allow deleting the asset belonging to the prefab parent                 var parentSurface = PrefabUtility.GetCorrespondingObjectFromSource(navSurface) as NavMeshSurface;                 if (parentSurface && navSurface.navMeshData == parentSurface.navMeshData)                     return null;             }              // Do not delete the NavMeshData asset referenced from a prefab until the prefab is saved             var prefabStage = PrefabStageUtility.GetPrefabStage(navSurface.gameObject);             var isPartOfPrefab = prefabStage != null && prefabStage.IsPartOfPrefabContents(navSurface.gameObject);             if (isPartOfPrefab && IsCurrentPrefabNavMeshDataStored(navSurface))                 return null;              return navSurface.navMeshData;         }          void ClearSurface(NavMeshSurface navSurface)         {             var hasNavMeshData = navSurface.navMeshData != null;             StoreNavMeshDataIfInPrefab(navSurface);              var assetToDelete = GetNavMeshAssetToDelete(navSurface);             navSurface.RemoveData();              if (hasNavMeshData)             {                 SetNavMeshData(navSurface, null);                 EditorSceneManager.MarkSceneDirty(navSurface.gameObject.scene);             }              if (assetToDelete)                 AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(assetToDelete));         }          public void StartBakingSurfaces(UnityEngine.Object[] surfaces)         {             // Remove first to avoid double registration of the callback             EditorApplication.update -= UpdateAsyncBuildOperations;             EditorApplication.update += UpdateAsyncBuildOperations;              foreach (NavMeshSurface surf in surfaces)             {                 StoreNavMeshDataIfInPrefab(surf);                  var oper = new AsyncBakeOperation();                  oper.BakeData = InitializeBakeData(surf);                 oper.BakeOperation = surf.UpdateNavMesh(oper.BakeData);                 oper.Surface = surf;                  m_BakeOperations.Add(oper);             }         }          static NavMeshData InitializeBakeData(NavMeshSurface surface)         {             var emptySources = new List<NavMeshBuildSource>();             var emptyBounds = new Bounds();             return UnityEngine.AI.NavMeshBuilder.BuildNavMeshData(surface.GetBuildSettings(), emptySources, emptyBounds                 , surface.transform.position, surface.transform.rotation);         }          void UpdateAsyncBuildOperations()         {             foreach (var oper in m_BakeOperations)             {                 if (oper.Surface == null || oper.BakeOperation == null)                     continue;                  if (oper.BakeOperation.isDone)                 {                     var surface = oper.Surface;                     var delete = GetNavMeshAssetToDelete(surface);                     if (delete != null)                         AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(delete));                      surface.RemoveData();                     SetNavMeshData(surface, oper.BakeData);                      if (surface.isActiveAndEnabled)                         surface.AddData();                     CreateNavMeshAsset(surface);                     EditorSceneManager.MarkSceneDirty(surface.gameObject.scene);                 }             }             m_BakeOperations.RemoveAll(o => o.BakeOperation == null || o.BakeOperation.isDone);             if (m_BakeOperations.Count == 0)                 EditorApplication.update -= UpdateAsyncBuildOperations;         }          public bool IsSurfaceBaking(NavMeshSurface surface)         {             if (surface == null)                 return false;              foreach (var oper in m_BakeOperations)             {                 if (oper.Surface == null || oper.BakeOperation == null)                     continue;                  if (oper.Surface == surface)                     return true;             }              return false;         }          public void ClearSurfaces(UnityEngine.Object[] surfaces)         {             foreach (NavMeshSurface s in surfaces)                 ClearSurface(s);         }          static void SetNavMeshData(NavMeshSurface navSurface, NavMeshData navMeshData)         {             var so = new SerializedObject(navSurface);             var navMeshDataProperty = so.FindProperty("m_NavMeshData");             navMeshDataProperty.objectReferenceValue = navMeshData;             so.ApplyModifiedPropertiesWithoutUndo();         }          void StoreNavMeshDataIfInPrefab(NavMeshSurface surfaceToStore)         {             var prefabStage = PrefabStageUtility.GetPrefabStage(surfaceToStore.gameObject);             var isPartOfPrefab = prefabStage != null && prefabStage.IsPartOfPrefabContents(surfaceToStore.gameObject);             if (!isPartOfPrefab)                 return;              // check if data has already been stored for this surface             foreach (var storedAssetInfo in m_PrefabNavMeshDataAssets)                 if (storedAssetInfo.Surface == surfaceToStore)                     return;              if (m_PrefabNavMeshDataAssets.Count == 0)             {                 PrefabStage.prefabSaving -= DeleteStoredNavMeshDataAssetsForOwnedSurfaces;                 PrefabStage.prefabSaving += DeleteStoredNavMeshDataAssetsForOwnedSurfaces;                  PrefabStage.prefabStageClosing -= ForgetUnsavedNavMeshDataChanges;                 PrefabStage.prefabStageClosing += ForgetUnsavedNavMeshDataChanges;             }              var isDataOwner = true;             if (PrefabUtility.IsPartOfPrefabInstance(surfaceToStore) && !PrefabUtility.IsPartOfModelPrefab(surfaceToStore))             {                 var basePrefabSurface = PrefabUtility.GetCorrespondingObjectFromSource(surfaceToStore) as NavMeshSurface;                 isDataOwner = basePrefabSurface == null || surfaceToStore.navMeshData != basePrefabSurface.navMeshData;             }             m_PrefabNavMeshDataAssets.Add(new SavedPrefabNavMeshData { Surface = surfaceToStore, NavMeshData = isDataOwner ? surfaceToStore.navMeshData : null });         }          bool IsCurrentPrefabNavMeshDataStored(NavMeshSurface surface)         {             if (surface == null)                 return false;              foreach (var storedAssetInfo in m_PrefabNavMeshDataAssets)             {                 if (storedAssetInfo.Surface == surface)                     return storedAssetInfo.NavMeshData == surface.navMeshData;             }              return false;         }          void DeleteStoredNavMeshDataAssetsForOwnedSurfaces(GameObject gameObjectInPrefab)         {             // Debug.LogFormat("DeleteStoredNavMeshDataAsset() when saving prefab {0}", gameObjectInPrefab.name);              var surfaces = gameObjectInPrefab.GetComponentsInChildren<NavMeshSurface>(true);             foreach (var surface in surfaces)                 DeleteStoredPrefabNavMeshDataAsset(surface);         }          void DeleteStoredPrefabNavMeshDataAsset(NavMeshSurface surface)         {             for (var i = m_PrefabNavMeshDataAssets.Count - 1; i >= 0; i--)             {                 var storedAssetInfo = m_PrefabNavMeshDataAssets[i];                 if (storedAssetInfo.Surface == surface)                 {                     var storedNavMeshData = storedAssetInfo.NavMeshData;                     if (storedNavMeshData != null && storedNavMeshData != surface.navMeshData)                     {                         var assetPath = AssetDatabase.GetAssetPath(storedNavMeshData);                         AssetDatabase.DeleteAsset(assetPath);                     }                      m_PrefabNavMeshDataAssets.RemoveAt(i);                     break;                 }             }              if (m_PrefabNavMeshDataAssets.Count == 0)             {                 PrefabStage.prefabSaving -= DeleteStoredNavMeshDataAssetsForOwnedSurfaces;                 PrefabStage.prefabStageClosing -= ForgetUnsavedNavMeshDataChanges;             }         }          void ForgetUnsavedNavMeshDataChanges(PrefabStage prefabStage)         {             // Debug.Log("On prefab closing - forget about this object's surfaces and stop caring about prefab saving");              if (prefabStage == null)                 return;              var allSurfacesInPrefab = prefabStage.prefabContentsRoot.GetComponentsInChildren<NavMeshSurface>(true);             NavMeshSurface surfaceInPrefab = null;             var index = 0;             do             {                 if (allSurfacesInPrefab.Length > 0)                     surfaceInPrefab = allSurfacesInPrefab[index];                  for (var i = m_PrefabNavMeshDataAssets.Count - 1; i >= 0; i--)                 {                     var storedPrefabInfo = m_PrefabNavMeshDataAssets[i];                     if (storedPrefabInfo.Surface == null)                     {                         // Debug.LogFormat("A surface from the prefab got deleted after it has baked a new NavMesh but it hasn't saved it. Now the unsaved asset gets deleted. ({0})", storedPrefabInfo.navMeshData);                          // surface got deleted, thus delete its initial NavMeshData asset                         if (storedPrefabInfo.NavMeshData != null)                         {                             var assetPath = AssetDatabase.GetAssetPath(storedPrefabInfo.NavMeshData);                             AssetDatabase.DeleteAsset(assetPath);                         }                          m_PrefabNavMeshDataAssets.RemoveAt(i);                     }                     else if (surfaceInPrefab != null && storedPrefabInfo.Surface == surfaceInPrefab)                     {                         //Debug.LogFormat("The surface {0} from the prefab was storing the original navmesh data and now will be forgotten", surfaceInPrefab);                          var baseSurface = PrefabUtility.GetCorrespondingObjectFromSource(surfaceInPrefab) as NavMeshSurface;                         if (baseSurface == null || surfaceInPrefab.navMeshData != baseSurface.navMeshData)                         {                             var assetPath = AssetDatabase.GetAssetPath(surfaceInPrefab.navMeshData);                             AssetDatabase.DeleteAsset(assetPath);                              //Debug.LogFormat("The surface {0} from the prefab has baked new NavMeshData but did not save this change so the asset has been now deleted. ({1})",                             //    surfaceInPrefab, assetPath);                         }                          m_PrefabNavMeshDataAssets.RemoveAt(i);                     }                 }             } while (++index < allSurfacesInPrefab.Length);              if (m_PrefabNavMeshDataAssets.Count == 0)             {                 PrefabStage.prefabSaving -= DeleteStoredNavMeshDataAssetsForOwnedSurfaces;                 PrefabStage.prefabStageClosing -= ForgetUnsavedNavMeshDataChanges;             }         }     } } 

Thank you in advance for your help!!^_^

PORTX Token Goes Live on CEXs and DEXs

PRESS RELEASE. The team at ChainPort is incredibly excited to update the public about PORTX’s Token Generation Event (TGE). The team has worked tirelessly to develop the most exemplary ecosystem token for the next-generation cross-chain bridge. Since its launch last year, ChainPort has created a new standard as a cross-chain bridge. ChainPort includes impressive security::Listen

PRESS RELEASE. The team at ChainPort is incredibly excited to update the public about PORTX’s Token Generation Event (TGE). The team has worked tirelessly to develop the most exemplary ecosystem token for the next-generation cross-chain bridge.

Since its launch last year, ChainPort has created a new standard as a cross-chain bridge. ChainPort includes impressive security features, full interoperability, and fast bridging of tokens. Currently, ChainPort supports over nine chains, has a port volume of $615,923,820, and has a total value of $71M.

Progress advances at an accelerated pace. For example, ChainPort has established a fee mechanism and bridge support for more chains, and the PORTX token is now an integral part of the ecosystem.

Even though PORTX’s TGE was supposed to take place earlier, different factors delayed the launch, including market conditions, rigorous testing of ChainPort’s security, and testing the new fee model.

With ChainPort’s fee model in place, ChainPort will accumulate all revenues until the TGE. Following PORTX’s TGE, up to 95% of all revenues will be swapped to PORTX tokens and redistributed per PORTX’s tokenomics. With the market stabilizing and the fee mechanism tested, ChainPort is ready to launch PORTX. The TGE for PORTX is taking place today, on the 20th of September, 2022.

The launch of the PORTX token is a significant milestone in ChainPort’s history. Launching the PORTX token makes ChainPort more significant than just a bridge. It becomes a fully-fledged ecosystem with PORTX at its heart.

The ChainPort team will launch the PORTX token on a centralized exchange and right after on several DEXs on different chains. ChainPort has partnered with top market makers and multiple DEXs.

Be sure to double-check the official contract address before on DEXs. The official contract address will be published following the launch.

Remember that PORTX on different chains will have separate contract addresses corresponding to each chain. Please double-check contract addresses to verify that the address is correct on the proper chain.

Trade PORTX on:

Gate.io

PancakeSwap

Uniswap

SpookySwap

Fantom Contract: 0x504ec4f9af7bbf8cad73ccc2121a3a7fb4c81bcf

Ethereum Contract: 0x104F3152D8ebFC3f679392977356962Ff36566aC

Polygon Contract: 0x189586b5f6317538ae50c20a976597da38984a24

BNB Chain Contract: 0x54c3b88b7e9702f915ddc6e483aaf369b2615f8d

PORTX holders can easily port their tokens to the four chains currently using ChainPort’s bridge. These chains include Ethereum, Polygon, BNB Chain/BSC, and Fantom. Porting is permissionless and will allow users to trade their tokens on Specific DEXs.

ChainPort may announce additional DEXs and exchanges at a later date.

About ChainPort

ChainPort is a next-gen cross-chain bridge that provides custodian-level security with full interoperability. ChainPort introduces an unprecedented security architecture, porting tokens safely across blockchains with just a click.

Security is always paramount for ChainPort, and 95% of the funds are stored in cold storage wallets provided by leading industry security experts: FireBlocks MPC and Gnosis-safe multi-sig.

ChainPort is a permissionless bridge already porting more than 190 tokens between blockchains, with additional projects joining daily. Porting is done in minutes through a friendly and straightforward UI without requiring technical integration.

Since its launch in 2021, Chainport has managed 40,000 ports and more than $630,000,000 in volume. Learn more by visiting ChainPort.io or reading the documentation.

Join the ChainPort community for updates:

ChainPort | Twitter | Telegram | ChainPort News | Documentation | Medium | Reddit

 

 

 


This is a press release. Readers should do their own due diligence before taking any actions related to the promoted company or any of its affiliates or services. Bitcoin.com is not responsible, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with the use of or reliance on any content, goods or services mentioned in the press release.

Error CS1061 unity how to fix the error? Blockchain Game using Moralis, Unity, C#

Shopping cart
There are no products in the cart!
Continue shopping
0