-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRCC_InitLoad.cs
More file actions
99 lines (79 loc) · 2.67 KB
/
Copy pathRCC_InitLoad.cs
File metadata and controls
99 lines (79 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//----------------------------------------------
// Realistic Car Controller
//
// Copyright © 2014 - 2017 BoneCracker Games
// http://www.bonecrackergames.com
// Buğra Özdoğanlar
//
//----------------------------------------------
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Collections.Generic;
public class RCC_InitLoad : MonoBehaviour {
[InitializeOnLoad]
public class InitOnLoad {
static InitOnLoad(){
SetEnabled("BCG_RCC", true);
if(!EditorPrefs.HasKey("RCC" + "V3.2b" + "Installed")){
EditorPrefs.SetInt("RCC" + "V3.2b" + "Installed", 1);
EditorUtility.DisplayDialog("Regards from BoneCracker Games", "Thank you for purchasing and using Realistic Car Controller. Please read the documentation before use. Also check out the online documentation for updated info. Have fun :)", "Let's get started");
if(EditorUtility.DisplayDialog("Importing BoneCracker Games Shared Assets", "Do you want to import ''BoneCracker Games Shared Assets'' to your project? It will be used for enter / exit on all vehicles created by BoneCracker Games in future.", "Import it", "No"))
AssetDatabase.ImportPackage("Assets/RealisticCarControllerV3/For BCG Shared Assets/BCG Shared Assets.unitypackage", true);
Selection.activeObject = RCC_Settings.Instance;
}
}
private static BuildTargetGroup[] buildTargetGroups = new BuildTargetGroup[]
{
BuildTargetGroup.Standalone,
BuildTargetGroup.Android,
BuildTargetGroup.iOS,
BuildTargetGroup.WebGL,
BuildTargetGroup.Facebook,
BuildTargetGroup.N3DS,
BuildTargetGroup.XboxOne,
BuildTargetGroup.PS4,
BuildTargetGroup.PSP2,
BuildTargetGroup.PSM,
BuildTargetGroup.tvOS,
BuildTargetGroup.SamsungTV,
BuildTargetGroup.Tizen,
BuildTargetGroup.Switch,
BuildTargetGroup.WiiU,
BuildTargetGroup.WSA
};
private static void SetEnabled(string defineName, bool enable)
{
//Debug.Log("setting "+defineName+" to "+enable);
foreach (var group in buildTargetGroups)
{
var defines = GetDefinesList(group);
if (enable)
{
if (defines.Contains(defineName))
{
return;
}
defines.Add(defineName);
}
else
{
if (!defines.Contains(defineName))
{
return;
}
while (defines.Contains(defineName))
{
defines.Remove(defineName);
}
}
string definesString = string.Join(";", defines.ToArray());
PlayerSettings.SetScriptingDefineSymbolsForGroup(group, definesString);
}
}
private static List<string> GetDefinesList(BuildTargetGroup group){
return new List<string>(PlayerSettings.GetScriptingDefineSymbolsForGroup(group).Split(';'));
}
}
}