Search Unity

Feedback Hash128

Discussion in 'Addressables' started by Deleted User, Apr 24, 2019.

  1. Deleted User

    Deleted User

    Guest

    Good evening.

    Any plans to include an easy looking up table for keys for the assets based on Hash128 to send over the network?
     
    Sylmerria likes this.
  2. Deleted User

    Deleted User

    Guest

  3. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Can you elaborate on exactly what you're asking for? Am I sending a hash to get a key? sending a key to get a hash? what network am I sending them over? and to what server?
     
  4. Deleted User

    Deleted User

    Guest

    Sorry if the question is not precise enough. My bad here.
    What I would want is to have runtime access to a KeyHash asset storage. In current state the package has one storage and both Hash128 and the asset Path are at the same Dictionary so it is not possible to get a Hash128 knowing an Asset name or Path. My current hack is to have a ScriptableObject that will map the asset path with its Hash128 value since it is an Editor feature and not accessible in build.

    Networking example. Server sends a message to spawn a Cube. The packet contains 128 bits of object Id instead of its string name. Later on the client spawns an object based on Hash128. The only problem is on server side, to get a Hash128 based on Asset path.

    So what I would to request a separate storage, Dictionary<string, Hash128> so I am able to get asset hashes based on their name/path.
     
  5. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Ah, I see. so the keys we have for a given asset are:
    - the address
    - the guid
    - any labels

    That guid can be stored as a Hash128. In our current implementation it isn't, it's a string, but it could be. Or at least the string should be able to be created by a Hash128.

    So now, if I understand your usecase correctly, you want to be able to have an active server to tell the game "spawn xyz" in the most efficient way possible. Saying the string address is not as efficient as you'd like. This right?

    And your active server knows the asset path of the things it wants to spawn, but wants to send this efficient thing.

    I guess my question comes back to: how does the server know the path? What's it's source of truth? I ask because if you were using AssetReferences, those store the guid. Or if you had editor code, you could easily translate path to guid in your own editor script. Or you could make a custom build script that saves off some sort of path to guid/hash map.

    Unless I'm misunderstanding your setup, this feels like a good and easy thing for you to add on to addressables, but not something we should add ourselves due to the somewhat specified nature of the need.