Skip to main content
added 81 characters in body
Source Link

I am using this code snippet in unity 2021.3.16 to create Asset bundles:

using [SerializeField]System.IO;
using UnityEditor;
using UnityEngine;
using System.Security.Cryptography;
public privateclass stringABEncryption _assetNameForAB
{

 = "Assets/Prefab  [MenuItem("ABD/Cube.prefab";Build AssetBundles")]
    privatestatic stringvoid _ABNameABCreate()
 = "MyAB";  {
    private    string _password_assetNameForAB = "llt";
"Assets/Prefab/Cube.prefab";
    [ContextMenu("Encrypt")]
    voidstring ABCreate()_ABName = "MyAB";
    {    
        AssetBundleBuild[] assetBundleBuilds = new AssetBundleBuild[1];
        assetBundleBuilds[0].assetBundleName = _ABName;
        assetBundleBuilds[0].assetBundleVariant = "";
        assetBundleBuilds[0].assetNames = new string[] { _assetNameForAB };

        BuildAssetBundleOptions buildAssetBundleOptions = BuildAssetBundleOptions.None;
        buildAssetBundleOptions |= BuildAssetBundleOptions.DeterministicAssetBundle;
        buildAssetBundleOptions |= BuildAssetBundleOptions.ChunkBasedCompression;
        

        string outputPath = Application.streamingAssetsPath  + "/EncryptedAB/";
      

        BuildPipeline.BuildAssetBundles(outputPath,
                                        assetBundleBuilds,
                                        buildAssetBundleOptionsBuildAssetBundleOptions.None,
                                        BuildTarget.StandaloneWindows64);

 

    }

}

Something very strange is happening. Compile time is perfectly fine but when I run this I get several errors:

Assets\ABEncryption.cs(27,36): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(38,9): error CS0103: The name 'BuildPipeline' does not exist in the current context

Assets\ABEncryption.cs(40,41): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(41,41): error CS0103: The name 'BuildTarget' does not exist in the current context

Assets\ABEncryption.cs(54,9): error CS0103: The name 'BuildPipeline' does not exist in the current context

Assets\ABEncryption.cs(55,41): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(56,41): error CS0103: The name 'BuildTarget' does not exist in the current context

Error building Player because scripts had compiler errors

I am running this method in the editor (on context menu). Here is the complete details enter image description here

I am using this code snippet in unity 2021.3.16 to create Asset bundles:

 [SerializeField]
    private string _assetNameForAB = "Assets/Prefab/Cube.prefab";
    private string _ABName = "MyAB";
    private string _password = "llt";

    [ContextMenu("Encrypt")]
    void ABCreate()
    {
        AssetBundleBuild[] assetBundleBuilds = new AssetBundleBuild[1];
        assetBundleBuilds[0].assetBundleName = _ABName;
        assetBundleBuilds[0].assetBundleVariant = "";
        assetBundleBuilds[0].assetNames = new string[] { _assetNameForAB };

        BuildAssetBundleOptions buildAssetBundleOptions = BuildAssetBundleOptions.None;
        buildAssetBundleOptions |= BuildAssetBundleOptions.DeterministicAssetBundle;
        buildAssetBundleOptions |= BuildAssetBundleOptions.ChunkBasedCompression;
        

        string outputPath = Application.streamingAssetsPath  + "/EncryptedAB/";
      

        BuildPipeline.BuildAssetBundles(outputPath,
                                        assetBundleBuilds,
                                        buildAssetBundleOptions,
                                        BuildTarget.StandaloneWindows64);

 

    }

Something very strange is happening. Compile time is perfectly fine but when I run this I get several errors:

Assets\ABEncryption.cs(27,36): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(38,9): error CS0103: The name 'BuildPipeline' does not exist in the current context

Assets\ABEncryption.cs(40,41): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(41,41): error CS0103: The name 'BuildTarget' does not exist in the current context

Assets\ABEncryption.cs(54,9): error CS0103: The name 'BuildPipeline' does not exist in the current context

Assets\ABEncryption.cs(55,41): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(56,41): error CS0103: The name 'BuildTarget' does not exist in the current context

Error building Player because scripts had compiler errors

I am running this method in the editor (on context menu). Here is the complete details enter image description here

I am using this code snippet in unity 2021.3.16 to create Asset bundles:

using System.IO;
using UnityEditor;
using UnityEngine;
using System.Security.Cryptography;
public class ABEncryption 
{

    [MenuItem("ABD/Build AssetBundles")]
    static void ABCreate()
    {
        string _assetNameForAB = "Assets/Prefab/Cube.prefab";
        string _ABName = "MyAB";
        
        AssetBundleBuild[] assetBundleBuilds = new AssetBundleBuild[1];
        assetBundleBuilds[0].assetBundleName = _ABName;
        assetBundleBuilds[0].assetBundleVariant = "";
        assetBundleBuilds[0].assetNames = new string[] { _assetNameForAB };

        BuildAssetBundleOptions buildAssetBundleOptions = BuildAssetBundleOptions.None;
        buildAssetBundleOptions |= BuildAssetBundleOptions.DeterministicAssetBundle;
        buildAssetBundleOptions |= BuildAssetBundleOptions.ChunkBasedCompression;

        string outputPath = Application.streamingAssetsPath  + "/EncryptedAB/";


        BuildPipeline.BuildAssetBundles(outputPath,
                                        assetBundleBuilds,
                                        BuildAssetBundleOptions.None,
                                        BuildTarget.StandaloneWindows64);

    }

}

Something very strange is happening. Compile time is perfectly fine but when I run this I get several errors:

Assets\ABEncryption.cs(27,36): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(38,9): error CS0103: The name 'BuildPipeline' does not exist in the current context

Assets\ABEncryption.cs(40,41): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(41,41): error CS0103: The name 'BuildTarget' does not exist in the current context

Assets\ABEncryption.cs(54,9): error CS0103: The name 'BuildPipeline' does not exist in the current context

Assets\ABEncryption.cs(55,41): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(56,41): error CS0103: The name 'BuildTarget' does not exist in the current context

Error building Player because scripts had compiler errors

I am running this method in the editor (on context menu). Here is the complete details enter image description here

More information added.
Source Link

I am using this code snippet in unity 2021.3.16 to create Asset bundles:

 [SerializeField]
    private string _assetNameForAB = "Assets/Prefab/Cube.prefab";
    private string _ABName = "MyAB";
    private string _password = "llt";

    [ContextMenu("Encrypt")]
    void ABCreate()
    {
        AssetBundleBuild[] assetBundleBuilds = new AssetBundleBuild[1];
        assetBundleBuilds[0].assetBundleName = _ABName;
        assetBundleBuilds[0].assetBundleVariant = "";
        assetBundleBuilds[0].assetNames = new string[] { _assetNameForAB };

        BuildAssetBundleOptions buildAssetBundleOptions = BuildAssetBundleOptions.None;
        buildAssetBundleOptions |= BuildAssetBundleOptions.DeterministicAssetBundle;
        buildAssetBundleOptions |= BuildAssetBundleOptions.ChunkBasedCompression;
    //buildAssetBundleOptions |= BuildAssetBundleOptions.CollectDependencies;  

        string outputPath = Application.streamingAssetsPath  + "/EncryptedAB/";
      

        BuildPipeline.BuildAssetBundles(outputPath,
                                        assetBundleBuilds,
                                        buildAssetBundleOptions,
                                        BuildTarget.StandaloneWindows64); 



    }

Something very strange is happening. Compile time is perfectly fine but when I run this I get several errors:

Assets\ABEncryption.cs(27,36): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(38,9): error CS0103: The name 'BuildPipeline' does not exist in the current context

Assets\ABEncryption.cs(40,41): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(41,41): error CS0103: The name 'BuildTarget' does not exist in the current context

Assets\ABEncryption.cs(54,9): error CS0103: The name 'BuildPipeline' does not exist in the current context

Assets\ABEncryption.cs(55,41): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(56,41): error CS0103: The name 'BuildTarget' does not exist in the current context

Error building Player because scripts had compiler errors

I am running this method in the editor (on context menu). Here is the complete details enter image description here

I am using this code snippet in unity 2021.3.16 to create Asset bundles:

void ABCreate()
{
    AssetBundleBuild[] assetBundleBuilds = new AssetBundleBuild[1];
    assetBundleBuilds[0].assetBundleName = _ABName;
    assetBundleBuilds[0].assetBundleVariant = "";
    assetBundleBuilds[0].assetNames = new string[] { _assetNameForAB };

    BuildAssetBundleOptions buildAssetBundleOptions = BuildAssetBundleOptions.None;
    buildAssetBundleOptions |= BuildAssetBundleOptions.DeterministicAssetBundle;
    buildAssetBundleOptions |= BuildAssetBundleOptions.ChunkBasedCompression;
    //buildAssetBundleOptions |= BuildAssetBundleOptions.CollectDependencies;

    string outputPath = Application.streamingAssetsPath  + "/EncryptedAB/";
    

    BuildPipeline.BuildAssetBundles(outputPath,
                                    assetBundleBuilds,
                                    buildAssetBundleOptions,
                                    BuildTarget.StandaloneWindows64);

}

Something very strange is happening. Compile time is perfectly fine but when I run this I get several errors:

Assets\ABEncryption.cs(27,36): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(38,9): error CS0103: The name 'BuildPipeline' does not exist in the current context

Assets\ABEncryption.cs(40,41): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(41,41): error CS0103: The name 'BuildTarget' does not exist in the current context

Assets\ABEncryption.cs(54,9): error CS0103: The name 'BuildPipeline' does not exist in the current context

Assets\ABEncryption.cs(55,41): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(56,41): error CS0103: The name 'BuildTarget' does not exist in the current context

Error building Player because scripts had compiler errors

I am using this code snippet in unity 2021.3.16 to create Asset bundles:

 [SerializeField]
    private string _assetNameForAB = "Assets/Prefab/Cube.prefab";
    private string _ABName = "MyAB";
    private string _password = "llt";

    [ContextMenu("Encrypt")]
    void ABCreate()
    {
        AssetBundleBuild[] assetBundleBuilds = new AssetBundleBuild[1];
        assetBundleBuilds[0].assetBundleName = _ABName;
        assetBundleBuilds[0].assetBundleVariant = "";
        assetBundleBuilds[0].assetNames = new string[] { _assetNameForAB };

        BuildAssetBundleOptions buildAssetBundleOptions = BuildAssetBundleOptions.None;
        buildAssetBundleOptions |= BuildAssetBundleOptions.DeterministicAssetBundle;
        buildAssetBundleOptions |= BuildAssetBundleOptions.ChunkBasedCompression;
        

        string outputPath = Application.streamingAssetsPath  + "/EncryptedAB/";
      

        BuildPipeline.BuildAssetBundles(outputPath,
                                        assetBundleBuilds,
                                        buildAssetBundleOptions,
                                        BuildTarget.StandaloneWindows64); 



    }

Something very strange is happening. Compile time is perfectly fine but when I run this I get several errors:

Assets\ABEncryption.cs(27,36): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(38,9): error CS0103: The name 'BuildPipeline' does not exist in the current context

Assets\ABEncryption.cs(40,41): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(41,41): error CS0103: The name 'BuildTarget' does not exist in the current context

Assets\ABEncryption.cs(54,9): error CS0103: The name 'BuildPipeline' does not exist in the current context

Assets\ABEncryption.cs(55,41): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(56,41): error CS0103: The name 'BuildTarget' does not exist in the current context

Error building Player because scripts had compiler errors

I am running this method in the editor (on context menu). Here is the complete details enter image description here

Code formatting
Source Link
DMGregory
  • 141k
  • 23
  • 258
  • 401

I am using this code snippet in unity 2021.3.16 to create Asset bundles:

void ABCreate() { AssetBundleBuild[] assetBundleBuilds = new AssetBundleBuild[1]; assetBundleBuilds[0].assetBundleName = _ABName; assetBundleBuilds[0].assetBundleVariant = ""; assetBundleBuilds[0].assetNames = new string[] { _assetNameForAB };

BuildAssetBundleOptions buildAssetBundleOptions = BuildAssetBundleOptions.None;
buildAssetBundleOptions |= BuildAssetBundleOptions.DeterministicAssetBundle;
buildAssetBundleOptions |= BuildAssetBundleOptions.ChunkBasedCompression;
//buildAssetBundleOptions |= BuildAssetBundleOptions.CollectDependencies;

string outputPath = Application.streamingAssetsPath  + "/EncryptedAB/";


BuildPipeline.BuildAssetBundles(outputPath,
                                assetBundleBuilds,
                                buildAssetBundleOptions,
                                BuildTarget.StandaloneWindows64);

}

void ABCreate()
{
    AssetBundleBuild[] assetBundleBuilds = new AssetBundleBuild[1];
    assetBundleBuilds[0].assetBundleName = _ABName;
    assetBundleBuilds[0].assetBundleVariant = "";
    assetBundleBuilds[0].assetNames = new string[] { _assetNameForAB };

    BuildAssetBundleOptions buildAssetBundleOptions = BuildAssetBundleOptions.None;
    buildAssetBundleOptions |= BuildAssetBundleOptions.DeterministicAssetBundle;
    buildAssetBundleOptions |= BuildAssetBundleOptions.ChunkBasedCompression;
    //buildAssetBundleOptions |= BuildAssetBundleOptions.CollectDependencies;

    string outputPath = Application.streamingAssetsPath  + "/EncryptedAB/";
    

    BuildPipeline.BuildAssetBundles(outputPath,
                                    assetBundleBuilds,
                                    buildAssetBundleOptions,
                                    BuildTarget.StandaloneWindows64);

}

And somethingSomething very strange is happening. Compile time is perfectly fine but when iI run this iI get several errors:

Assets\ABEncryption.cs(27,36): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(38,9): error CS0103: The name 'BuildPipeline' does not exist in the current context

Assets\ABEncryption.cs(40,41): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(41,41): error CS0103: The name 'BuildTarget' does not exist in the current context

Assets\ABEncryption.cs(54,9): error CS0103: The name 'BuildPipeline' does not exist in the current context

Assets\ABEncryption.cs(55,41): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(56,41): error CS0103: The name 'BuildTarget' does not exist in the current context

Error building Player because scripts had compiler errors

I am using this code snippet in unity 2021.3.16 to create Asset bundles:

void ABCreate() { AssetBundleBuild[] assetBundleBuilds = new AssetBundleBuild[1]; assetBundleBuilds[0].assetBundleName = _ABName; assetBundleBuilds[0].assetBundleVariant = ""; assetBundleBuilds[0].assetNames = new string[] { _assetNameForAB };

BuildAssetBundleOptions buildAssetBundleOptions = BuildAssetBundleOptions.None;
buildAssetBundleOptions |= BuildAssetBundleOptions.DeterministicAssetBundle;
buildAssetBundleOptions |= BuildAssetBundleOptions.ChunkBasedCompression;
//buildAssetBundleOptions |= BuildAssetBundleOptions.CollectDependencies;

string outputPath = Application.streamingAssetsPath  + "/EncryptedAB/";


BuildPipeline.BuildAssetBundles(outputPath,
                                assetBundleBuilds,
                                buildAssetBundleOptions,
                                BuildTarget.StandaloneWindows64);

}

And something very strange is happening. Compile time is perfectly fine but when i run this i get several errors:

Assets\ABEncryption.cs(27,36): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(38,9): error CS0103: The name 'BuildPipeline' does not exist in the current context

Assets\ABEncryption.cs(40,41): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(41,41): error CS0103: The name 'BuildTarget' does not exist in the current context

Assets\ABEncryption.cs(54,9): error CS0103: The name 'BuildPipeline' does not exist in the current context

Assets\ABEncryption.cs(55,41): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(56,41): error CS0103: The name 'BuildTarget' does not exist in the current context

Error building Player because scripts had compiler errors

I am using this code snippet in unity 2021.3.16 to create Asset bundles:

void ABCreate()
{
    AssetBundleBuild[] assetBundleBuilds = new AssetBundleBuild[1];
    assetBundleBuilds[0].assetBundleName = _ABName;
    assetBundleBuilds[0].assetBundleVariant = "";
    assetBundleBuilds[0].assetNames = new string[] { _assetNameForAB };

    BuildAssetBundleOptions buildAssetBundleOptions = BuildAssetBundleOptions.None;
    buildAssetBundleOptions |= BuildAssetBundleOptions.DeterministicAssetBundle;
    buildAssetBundleOptions |= BuildAssetBundleOptions.ChunkBasedCompression;
    //buildAssetBundleOptions |= BuildAssetBundleOptions.CollectDependencies;

    string outputPath = Application.streamingAssetsPath  + "/EncryptedAB/";
    

    BuildPipeline.BuildAssetBundles(outputPath,
                                    assetBundleBuilds,
                                    buildAssetBundleOptions,
                                    BuildTarget.StandaloneWindows64);

}

Something very strange is happening. Compile time is perfectly fine but when I run this I get several errors:

Assets\ABEncryption.cs(27,36): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(38,9): error CS0103: The name 'BuildPipeline' does not exist in the current context

Assets\ABEncryption.cs(40,41): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(41,41): error CS0103: The name 'BuildTarget' does not exist in the current context

Assets\ABEncryption.cs(54,9): error CS0103: The name 'BuildPipeline' does not exist in the current context

Assets\ABEncryption.cs(55,41): error CS0103: The name 'BuildAssetBundleOptions' does not exist in the current context

Assets\ABEncryption.cs(56,41): error CS0103: The name 'BuildTarget' does not exist in the current context

Error building Player because scripts had compiler errors

Source Link
Loading