![Schaken-Mods](/assets/img/avatar_default.png)
There is an asset in the store I grabbed. the coding is WAY above my head, I got about half of it and integrated and adapted what I can to it. im going as far as I can with it and ill come back in a few month when I understand t better.
70 lines
2.6 KiB
C#
70 lines
2.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using UnityEngine;
|
|
using UnityEngine.Serialization;
|
|
|
|
namespace UnityEditor.AddressableAssets.Settings.GroupSchemas
|
|
{
|
|
/// <summary>
|
|
/// Schema for content updates.
|
|
/// </summary>
|
|
// [CreateAssetMenu(fileName = "ContentUpdateGroupSchema.asset", menuName = "Addressables/Group Schemas/Content Update")]
|
|
[DisplayName("Content Update Restriction")]
|
|
public class ContentUpdateGroupSchema : AddressableAssetGroupSchema
|
|
{
|
|
enum ContentType
|
|
{
|
|
CanChangePostRelease,
|
|
CannotChangePostRelease
|
|
}
|
|
|
|
[FormerlySerializedAs("m_staticContent")]
|
|
[SerializeField]
|
|
bool m_StaticContent;
|
|
/// <summary>
|
|
/// Is the group static. This property is used in determining which assets need to be moved to a new remote group during the content update process.
|
|
/// </summary>
|
|
public bool StaticContent
|
|
{
|
|
get { return m_StaticContent; }
|
|
set
|
|
{
|
|
m_StaticContent = value;
|
|
SetDirty(true);
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public override void OnGUI()
|
|
{
|
|
ContentType current = m_StaticContent ? ContentType.CannotChangePostRelease : ContentType.CanChangePostRelease;
|
|
var newType = (ContentType)EditorGUILayout.EnumPopup("Update Restriction", current);
|
|
if (newType != current)
|
|
StaticContent = newType == ContentType.CannotChangePostRelease;
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public override void OnGUIMultiple(List<AddressableAssetGroupSchema> otherSchemas)
|
|
{
|
|
var so = new SerializedObject(this);
|
|
var prop = so.FindProperty("m_StaticContent");
|
|
|
|
// Type/Static Content
|
|
ShowMixedValue(prop, otherSchemas, typeof(bool), "m_StaticContent");
|
|
EditorGUI.BeginChangeCheck();
|
|
ContentType current = m_StaticContent ? ContentType.CannotChangePostRelease : ContentType.CanChangePostRelease;
|
|
var newType = (ContentType)EditorGUILayout.EnumPopup("Update Restriction", current);
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
StaticContent = newType == ContentType.CannotChangePostRelease;
|
|
foreach (var s in otherSchemas)
|
|
(s as ContentUpdateGroupSchema).StaticContent = (newType == ContentType.CannotChangePostRelease);
|
|
}
|
|
EditorGUI.showMixedValue = false;
|
|
|
|
so.ApplyModifiedProperties();
|
|
}
|
|
}
|
|
}
|