Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

How to create meta files without unity / unity api

Discussion in 'Package Manager' started by LPhilipp, Oct 8, 2019.

  1. LPhilipp

    LPhilipp

    Joined:
    Apr 27, 2018
    Posts:
    6
    Hi,
    so a meta file is something like this:

    fileFormatVersion: 2 --> magic 2, think its just a version number of meta format
    guid: --> is this just a guid like from visual studio without the - ? MAIN Question here!
    folderAsset: yes --> ya, if its a folder
    DefaultImporter: --> some blabla
    externalObjects: {}
    userData:
    assetBundleName:
    assetBundleVariant:

    Is it possible to just create such a textfile an generate a guid in visual studio (removing the - ) ?? Or does Unity do some magic to generate the guid ?

    why: Its for creating custom registry npm packages. Where every file/folder has to have a meta but is not part of a unity project...

    Greetings
    Philipp
     
  2. M_R

    M_R

    Joined:
    Apr 15, 2015
    Posts:
    484
    1) yes the GUID is just a 128 bit hex-encoded value. important: ensure it is unique
    2) beware that the DefaultImporter only applies to folders. other asset types (e.g. textures) have their own importers and their .meta is wildly different.
    e.g: this is for a script:
    Code (CSharp):
    1. fileFormatVersion: 2
    2. guid: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    3. MonoImporter:
    4.   externalObjects: {}
    5.   serializedVersion: 2
    6.   defaultReferences: []
    7.   executionOrder: 0
    8.   icon: {instanceID: 0}
    9.   userData:
    10.   assetBundleName:
    11.   assetBundleVariant:
    12.  
    texture:
    Code (CSharp):
    1. fileFormatVersion: 2
    2. guid: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    3. timeCreated: 1435262664
    4. licenseType: Pro
    5. TextureImporter:
    6.   fileIDToRecycleName: {}
    7.   serializedVersion: 2
    8.   mipmaps:
    9.     mipMapMode: 0
    10.     enableMipMap: 0
    11.     linearTexture: 0
    12.     correctGamma: 0
    13.     fadeOut: 0
    14.     borderMipMap: 0
    15.     mipMapFadeDistanceStart: 1
    16.     mipMapFadeDistanceEnd: 3
    17.   bumpmap:
    18.     convertToNormalMap: 0
    19.     externalNormalMap: 0
    20.     heightScale: .25
    21.     normalMapFilter: 0
    22.   isReadable: 0
    23.   grayScaleToAlpha: 0
    24.   generateCubemap: 0
    25.   cubemapConvolution: 0
    26.   cubemapConvolutionSteps: 8
    27.   cubemapConvolutionExponent: 1.5
    28.   seamlessCubemap: 0
    29.   textureFormat: -3
    30.   maxTextureSize: 2048
    31.   textureSettings:
    32.     filterMode: 2
    33.     aniso: 16
    34.     mipBias: -1
    35.     wrapMode: 1
    36.   nPOTScale: 0
    37.   lightmap: 0
    38.   rGBM: 0
    39.   compressionQuality: 50
    40.   spriteMode: 1
    41.   spriteExtrude: 1
    42.   spriteMeshType: 1
    43.   alignment: 0
    44.   spritePivot: {x: .5, y: .5}
    45.   spriteBorder: {x: 0, y: 0, z: 0, w: 0}
    46.   spritePixelsToUnits: 100
    47.   alphaIsTransparency: 1
    48.   textureType: 8
    49.   buildTargetSettings: []
    50.   spriteSheet:
    51.     sprites: []
    52.   spritePackingTag:
    53.   userData:
    54.   assetBundleName:
    55.   assetBundleVariant:
    56.  
    etc...

    it also depends on the Unity version
     
  3. LPhilipp

    LPhilipp

    Joined:
    Apr 27, 2018
    Posts:
    6
    So for complex assets like textures, prefabs... i go the unity way, but for simple folders, changelog... its possible to simply create one...

    Thanks!