Skip to content

How to set reference with script? #8

Description

@nguyentrong101094

I have to write editor script that set the reference using a csv file.

var reorderedStages = new SmartReference.Runtime.SmartReference<GameObject>[stagePack.Stages.Count];

            foreach (var pair in mapping)
            {
                //...
                if (originalId >= 0 && originalId < stagePack.Stages.Count && newIndex >= 0 && newIndex < reorderedStages.Length)
                {
                    reorderedStages[newIndex] = AssetLoadWrapper.LoadStage(string.Format(AssetLoadWrapper.STAGE_PREFAB_NAME_FORMAT, originalId), null);
                }
            }

AssetLoadWrapper.LoadStage return a gameObject prefab.

setting reorderedStages's value this way is not allowed. So how do I set the value of SmartReference in code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions