Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

What's ReadOnly Tags actually Mean?

Discussion in 'Project Tiny' started by kuailaiwanli, Jul 28, 2021.

  1. kuailaiwanli

    kuailaiwanli

    Joined:
    Apr 22, 2013
    Posts:
    47
    In JobChunk,What's a ReadOnly tag ComponentTypeHandle actually mean?
    Code (CSharp):
    1. [ReadOnly] public ComponentTypeHandle<MyComp> compType
    2. var comps = chunk.GetNativeArray(compType)
    3. compType = GetComponentTypeHandle<MyComp>(true)
    The compType can be modified even if it's already set to readonly.

    I'm confused.
     
    Last edited: Jul 28, 2021
  2. GilCat

    GilCat

    Joined:
    Sep 21, 2013
    Posts:
    676
    You shouldn’t be able to change it and should get an exception when attempting to write on it.