Here are the examples of the csharp api UnityEngine.Debug.LogWarning(object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
753 Examples
19
Source : MVImporter.cs
with MIT License
from IxxyXR
with MIT License
from IxxyXR
public static MVMainChunk LoadVOXFromData(byte[] data, bool generateFaces = true) {
using (MemoryStream ms = new MemoryStream (data)) {
using (BinaryReader br = new BinaryReader (ms)) {
MVMainChunk mainChunk = new MVMainChunk ();
// "VOX "
br.ReadInt32 ();
// "VERSION "
mainChunk.version = br.ReadBytes(4);
byte[] chunkId = br.ReadBytes (4);
if (chunkId [0] != 'M' ||
chunkId [1] != 'A' ||
chunkId [2] != 'I' ||
chunkId [3] != 'N') {
Debug.LogError ("[MVImport] Invalid MainChunk ID, main chunk expected");
return null;
}
int chunkSize = br.ReadInt32 ();
int childrenSize = br.ReadInt32 ();
// main chunk should have nothing... skip
br.ReadBytes (chunkSize);
int readSize = 0;
while (readSize < childrenSize) {
chunkId = br.ReadBytes (4);
if (chunkId [0] == 'P' &&
chunkId [1] == 'A' &&
chunkId [2] == 'C' &&
chunkId [3] == 'K') {
int chunkContentBytes = br.ReadInt32 ();
int childrenBytes = br.ReadInt32 ();
br.ReadInt32 ();
readSize += chunkContentBytes + childrenBytes + 4 * 3;
}
else if (chunkId [0] == 'S' &&
chunkId [1] == 'I' &&
chunkId [2] == 'Z' &&
chunkId [3] == 'E') {
readSize += ReadSizeChunk (br, mainChunk);
} else if (chunkId [0] == 'X' &&
chunkId [1] == 'Y' &&
chunkId [2] == 'Z' &&
chunkId [3] == 'I') {
readSize += ReadVoxelChunk (br, mainChunk.voxelChunk);
} else if (chunkId [0] == 'R' &&
chunkId [1] == 'G' &&
chunkId [2] == 'B' &&
chunkId [3] == 'A') {
mainChunk.palatte = new Color[256];
readSize += ReadPalattee (br, mainChunk.palatte);
}
else {
Debug.LogWarning ("[MVImport] Chunk ID not recognized, got " + System.Text.Encoding.ASCII.GetString(chunkId));
int chunkContentBytes = br.ReadInt32();
int childrenBytes = br.ReadInt32();
br.ReadBytes(chunkContentBytes + childrenBytes);
readSize += chunkContentBytes + childrenBytes + 12;
}
}
if (generateFaces)
GenerateFaces(mainChunk.voxelChunk);
if (mainChunk.palatte == null)
mainChunk.palatte = MVMainChunk.defaultPalatte;
return mainChunk;
}
}
}
19
Source : MVImporter.cs
with MIT License
from IxxyXR
with MIT License
from IxxyXR
static int ReadPalattee(BinaryReader br, Color[] colors)
{
int chunkSize = br.ReadInt32 ();
int childrenSize = br.ReadInt32 ();
for (int i = 0; i < 256; ++i) {
colors [i] = new Color ((float)br.ReadByte () / 255.0f, (float)br.ReadByte () / 255.0f, (float)br.ReadByte () / 255.0f, (float)br.ReadByte () / 255.0f);
}
if (childrenSize > 0) {
br.ReadBytes (childrenSize);
Debug.LogWarning ("[MVImporter] Nested chunk not supported");
}
return chunkSize + childrenSize + 4 * 3;
}
19
Source : DeviceGeoReference.cs
with MIT License
from jbienzms
with MIT License
from jbienzms
private async Task InnerStartTrackingAsync(CancellationToken cancellationToken)
{
// Editor delay times below are based on this thread: https://answers.unity.com/questions/1317246/unity5-and-unity-remote-5-will-not-work-with-gps-o.html
#if UNITY_EDITOR
Debug.Log("Unity Editor does not support location. Waiting for Unity Remote to connect...");
// In editor only, wait until Unity connects to the remote device
while (!UnityEditor.EditorApplication.isRemoteConnected)
{
try
{
await Task.Delay(500, cancellationToken);
}
catch (TaskCanceledException inner)
{
throw new TaskCanceledException("Unity Remote did not connect before task was canceled.", inner);
}
}
// Next, wait another 5 seconds to make sure the remote services like location are actually available
Debug.Log("Waiting for Unity Remote services to become available...");
await Task.Delay(5000, cancellationToken);
#endif
// Next, check to see if user has enabled location services
if (!Input.location.isEnabledByUser)
{
// Some platforms (like iOS) will prompt to enable even if disabled
Debug.LogWarning("Location access is not enabled. Attempting to start anyway.");
}
// Start service with requested parameters
Input.location.Start(desiredAccuracy, updateDistance);
#if UNITY_EDITOR
// In editor only, wait for remote location services to start the initialization process
Debug.Log("Waiting for Remote Location services to begin initializing...");
while (Input.location.status == LocationServiceStatus.Stopped)
{
await Task.Delay(500, cancellationToken);
}
#endif // UNITY_EDITOR
// Wait until location service finishes initializing
Debug.Log("Waiting for location services to complete initialization...");
while (Input.location.status == LocationServiceStatus.Initializing)
{
await Task.Delay(500, cancellationToken);
}
// Finally, make sure location services are running
if (Input.location.status != LocationServiceStatus.Running)
{
throw new UnauthorizedAccessException("Location services could not be started.");
}
// Enable the compreplaced and gyroscope too
Input.compreplaced.enabled = true;
Input.gyro.enabled = true;
#if UNITY_EDITOR
// In editor only, wait for remote location services to start the initialization process
Debug.Log("Waiting for Remote Compreplaced services to initialize...");
while (!Input.compreplaced.enabled)
{
await Task.Delay(500, cancellationToken);
}
#endif // UNITY_EDITOR
if (!Input.compreplaced.enabled)
{
Debug.LogWarning("Compreplaced could not be enabled.");
}
// Tracking!
Debug.Log("Location services running!");
IsTracking = true;
}
19
Source : NudgeRefinement.cs
with MIT License
from jbienzms
with MIT License
from jbienzms
protected virtual void CreateController()
{
if (controller != null)
{
Debug.LogWarning($"{nameof(CreateController)} called but controller is already created.");
return;
}
if (controllerPrefab == null)
{
Debug.LogWarning($"{nameof(CreateController)} called but {nameof(ControllerPrefab)} is not defined.");
return;
}
// Instantiate
controller = Instantiate(controllerPrefab);
}
19
Source : NudgeRefinement.cs
with MIT License
from jbienzms
with MIT License
from jbienzms
public virtual void HideController()
{
if (controller == null)
{
Debug.LogWarning($"{nameof(HideController)} called but no controller is in use.");
return;
}
// Deactivate
controller.gameObject.SetActive(false);
}
19
Source : NudgeRefinement.cs
with MIT License
from jbienzms
with MIT License
from jbienzms
public virtual void ShowController()
{
if (controller == null)
{
Debug.LogWarning($"{nameof(ShowController)} called but no controller is in use.");
return;
}
// Deactivate
controller.gameObject.SetActive(true);
}
19
Source : RefinementBase.cs
with MIT License
from jbienzms
with MIT License
from jbienzms
public void CancelRefinement()
{
// Make sure we're refining
if (!isRefining)
{
Debug.LogWarning($"{nameof(CancelRefinement)} called but not refining.");
return;
}
// Call override
OnRefinementCanceling();
// Not refining
isRefining = false;
// Restore transform since canceled
RestoreLastTransform();
// Call override
OnRefinementCanceled();
}
19
Source : RefinementBase.cs
with MIT License
from jbienzms
with MIT License
from jbienzms
public void FinishRefinement()
{
// Make sure we're refining
if (!isRefining)
{
Debug.LogWarning($"{nameof(FinishRefinement)} called but not refining.");
return;
}
// Not refining
isRefining = false;
// Call override
OnRefinementFinished();
}
19
Source : RefinementBase.cs
with MIT License
from jbienzms
with MIT License
from jbienzms
public void StartRefinement()
{
// Make sure we're not already refining
if (isRefining)
{
Debug.LogWarning($"{nameof(StartRefinement)} called but already refining.");
return;
}
// Save transform in case of cancellation
SaveLastTransform();
// Call override
OnRefinementStarted();
// Refining
isRefining = true;
}
19
Source : AzureAnchorAlignment.cs
with MIT License
from jbienzms
with MIT License
from jbienzms
protected async override void Start()
{
// Preplaced to base first
base.Start();
// If load on start is true and we have an ID, load
if (loadOnStart)
{
if (string.IsNullOrEmpty(anchorId))
{
// Warn about invalid ID
Debug.LogWarning($"{nameof(LoadOnStart)} is true, but {nameof(AnchorId)} is invalid. Not loading.");
}
else
{
// Attempt to load
await LoadCloudAsync();
}
}
}
19
Source : DeviceGeoReference.cs
with MIT License
from jbienzms
with MIT License
from jbienzms
private void RestartTracking()
{
if (!IsTracking)
{
Debug.LogWarning($"{nameof(DeviceGeoReference)} {nameof(RestartTracking)} called but device is not tracking.");
return;
}
// Stop tracking
StopTracking();
// Try to start tracking again
TryStartTracking();
}
19
Source : GeoAlignment.cs
with MIT License
from jbienzms
with MIT License
from jbienzms
protected override void ApplyLocation(LocationData location)
{
// Preplaced to base first (HeadingAlignment doesn't do anything with location)
base.ApplyLocation(location);
// If we have no reference or data, we're in inhibited state
if (location == null)
{
State = AlignmentState.Inhibited;
Debug.LogWarning($"{nameof(GeoAlignment)} {name}: {nameof(GeoReference)} data unavailable - Inhibited.");
return;
}
// Get the distance between us and the reference point
Vector3 offset;
if (relativeAlreplacedude)
{
offset = location.GeoPosition.DistanceTo(lareplacedude, longitude, location.GeoPosition.alreplacedude + alreplacedude);
}
else
{
offset = location.GeoPosition.DistanceTo(lareplacedude, longitude, alreplacedude);
}
// Calculate our new position based on the reference position plus offset
lastPosition = location.LocalPosition + offset;
//Debug.Log(
// $"GPS Lat: {location.GeoPosition.lareplacedude}, Lon: {location.GeoPosition.longitude}, Alt: {location.GeoPosition.alreplacedude}\r\n" +
// $"Target Lat: {this.lareplacedude}, Lon: {this.longitude}, Alt: {this.alreplacedude}\r\n" +
// $"GPS Offset x: {offset.x}, y: {offset.y}, z: {offset.z}\r\n" +
// $"Pos x: {lastPosition.x}, y: {lastPosition.y}, z: {lastPosition.z}\r\n" +
// $"");
// Update our transform position
transform.position = lastPosition;
}
19
Source : HeadingAlignment.cs
with MIT License
from jbienzms
with MIT License
from jbienzms
protected override void ApplyHeading(HeadingData heading)
{
// If we have no reference or data, we're in inhibited state
if (heading == null)
{
State = AlignmentState.Inhibited;
Debug.LogWarning($"{nameof(HeadingAlignment)} {name}: {nameof(GeoReference)} heading data unavailable - Inhibited.");
return;
}
// Calculate heading as an offset from north
float calcHeading = heading.NorthHeading + this.northRotation;
// Apply rotation
// Debug.Log($"calcHeading: {calcHeading}");
transform.localRotation = Quaternion.Euler(0, calcHeading, 0);
}
19
Source : MultiParentAlignment.cs
with MIT License
from jbienzms
with MIT License
from jbienzms
protected override void ApplyParents(bool force = false)
{
// If there are no options, warn and bail
if (CurrentParents.Count < 1)
{
State = AlignmentState.Inhibited;
Debug.LogWarning($"{nameof(MultiParentAlignment)}: No {nameof(CurrentParents)} available to apply.");
return;
}
// If there is only one, apply it immediately
if (CurrentParents.Count == 1)
{
// Get single parent
ParentAlignmentOptions parentOption = CurrentParents[0];
// Make our transform a child of the frame
this.transform.SetParent(parentOption.Frame.transform, worldPositionStays: false);
// Apply transform modifications locally
this.transform.localPosition = parentOption.Position;
this.transform.localRotation = parentOption.Rotation;
this.transform.localScale = parentOption.Scale;
}
else
{
// Attempt to get the reference transform
Transform reference = GetReferenceTransform();
// If no reference transform available, we can't continue
if (reference == null)
{
State = AlignmentState.Inhibited;
Debug.LogWarning($"{nameof(MultiParentAlignment)}: No reference transform could be determined.");
return;
}
// Placeholders
Vector3 weightedPos = Vector3.zero;
Quaternion weightedRot = Quaternion.idenreplacedy;
Vector3 weightedScale = Vector3.zero;
// Use inspector-configurable power factor for Inverse Distance Weighting
Double power = distancePower;
// Calculate inverse distance weights for each option
var weightedParents = (from option in CurrentParents
select new WeightedParent()
{
Option = option,
InverseDistanceWeight = 1d / Math.Pow(power, option.DistanceSort(reference)),
}).ToList();
// Get total overall inverse distance weight
Double totalIDW = weightedParents.Sum(o => o.InverseDistanceWeight);
// Calculate individual weights
weightedParents.ForEach(o => o.Weight = (float)(o.InverseDistanceWeight / totalIDW));
// Calculate weighted offsets in WORLD coordinates
weightedParents.ForEach(o =>
{
weightedPos += (o.Option.Frame.transform.TransformPoint(o.Option.Position)).Weighted(o.Weight);
weightedRot *= (o.Option.Frame.transform.rotation * o.Option.Rotation).Weighted(o.Weight);
weightedScale += (Vector3.Scale(o.Option.Frame.transform.localScale, o.Option.Scale)).Weighted(o.Weight);
});
// Most of the time scale will be 1.0. However,truncating
// errors during weighted calculations averaging can end up
// with something other than 1.0. Let's take care of that.
if (weightedScale.Approximately(Vector3.one))
{
weightedScale = Vector3.one;
}
// Set no parent
this.transform.parent = null;
// Apply offsets globally
this.transform.position = weightedPos;
this.transform.rotation = weightedRot;
this.transform.localScale = weightedScale;
}
// Done!
}
19
Source : MultiParentBase.cs
with MIT License
from jbienzms
with MIT License
from jbienzms
public virtual void UpdateTransform(bool force=false)
{
// If there are no parent options, nothing to do
if (parentOptions.Count == 0)
{
State = AlignmentState.Inhibited;
Debug.LogWarning($"{nameof(MultiParentAlignment)}: No parent options to select from.");
return;
}
// Validate the parent options
ValidateParents();
// Use virtual method to select the best parent option
CurrentParents = SelectParents();
// Actually apply the parents
ApplyParents(force: force);
// Resolved
State = AlignmentState.Tracking;
}
19
Source : ParentAlignmentOptions.cs
with MIT License
from jbienzms
with MIT License
from jbienzms
public virtual bool IsMeetingRequirements()
{
// Can't be null
if (frame == null) { return false; }
// Get alignment strategy
IAlignmentStrategy strategy = frame.AlignmentStrategy;
// If no strategy, warn
if (strategy == null)
{
Debug.LogWarning($"Parent frame '{frame.Id}' has no alignment strategy.");
return false;
}
// Check the state
if (minimumState > AlignmentState.Error)
{
// Strategy state must match minimum
if (strategy.State < minimumState) { return false; }
}
// Check the accuracy
if (minimumAccuracy != Vector3.zero)
{
// Strategy accuracy match minimum
if ((minimumAccuracy.x > 0) && (strategy.Accuracy.x > minimumAccuracy.x)) { return false; }
if ((minimumAccuracy.y > 0) && (strategy.Accuracy.y > minimumAccuracy.y)) { return false; }
if ((minimumAccuracy.z > 0) && (strategy.Accuracy.z > minimumAccuracy.z)) { return false; }
}
// All checks preplaceded
return true;
}
19
Source : RefinementExampleManager.cs
with MIT License
from jbienzms
with MIT License
from jbienzms
public void BeginAddAnchor()
{
// If already in another mode, ignore
if (mode != RefinementExampleMode.None)
{
Debug.LogWarning($"{nameof(BeginAddAnchor)} called but already in {mode}");
return;
}
// Start adding a new anchor
mode = RefinementExampleMode.AddAnchor;
anchorStep = AddAnchorStep.New;
NextStep();
}
19
Source : RefinementExampleManager.cs
with MIT License
from jbienzms
with MIT License
from jbienzms
public void CancelAddAnchor()
{
// If in another mode, ignore
if (mode != RefinementExampleMode.AddAnchor)
{
Debug.LogWarning($"{nameof(CancelAddAnchor)} called but in {mode}");
return;
}
// Now canceling
mode = RefinementExampleMode.AddAnchorCancel;
if (largeScaleRefinement != null)
{
// Cancel refinement of the large scale model if in progress
if (largeScaleRefinement.IsRefining)
{
largeScaleRefinement.CancelRefinement();
}
// Unsubscribe from refinement events
UnsubscribeRefinement(largeScaleRefinement);
// No current large scale refinement
largeScaleRefinement = null;
}
// Unsubscribe from anchor events
UnsubscribeAnchor(newAnchor);
// Delete the new anchor game object and all children
DestroyImmediate(newAnchor.gameObject);
newAnchor = null;
// Re-enable MultiParent alignment
multiParent.enabled = true;
// Show the model
ShowModel();
// Done
anchorStep = AddAnchorStep.Done;
mode = RefinementExampleMode.None;
}
19
Source : RefinementExampleManager.cs
with MIT License
from jbienzms
with MIT License
from jbienzms
public void FinishAddAnchor()
{
// If in another mode, ignore
if (mode != RefinementExampleMode.AddAnchor)
{
Debug.LogWarning($"{nameof(FinishAddAnchor)} called but in {mode}");
return;
}
// Do the finishing step
DoStep(AddAnchorStep.Finishing);
}
19
Source : BallUserControl.cs
with MIT License
from joanby
with MIT License
from joanby
private void Awake()
{
// Set up the reference.
ball = GetComponent<Ball>();
// get the transform of the main camera
if (Camera.main != null)
{
cam = Camera.main.transform;
}
else
{
Debug.LogWarning(
"Warning: no main camera found. Ball needs a Camera tagged \"MainCamera\", for camera-relative controls.");
// we use world-relative controls in this case, which may not be what the user wants, but hey, we warned them!
}
}
19
Source : CodeGenConfigEditor.cs
with Apache License 2.0
from KeyleXiao
with Apache License 2.0
from KeyleXiao
public void WriteFile(CodeGen item, string path)
{
if (string.IsNullOrEmpty(templateFile)) return;
string temp = templateFile;
temp = temp.Replace("$[EDITOR_NAME]", item.EditorName);
temp = temp.Replace("$[CLreplaced_TYPE]", item.ClreplacedType);
temp = temp.Replace("$[SUB_TYPE]", item.SubType);
temp = temp.Replace("$[EDITOR_PATH]", item.EditorPath);
temp = temp.Replace("$[CODE_GEN_ID]", item.ID.ToString());
if (File.Exists(path)) File.Delete(path);
File.WriteAllText(path, temp, System.Text.Encoding.UTF8);
Debug.LogWarning(string.Format("Success Build !\n{0}", path));
replacedetDatabase.Refresh();
Close();
}
19
Source : GLTFComponent.cs
with MIT License
from KhronosGroup
with MIT License
from KhronosGroup
private async void Start()
{
if (!loadOnStart) return;
try
{
await Load();
}
#if WINDOWS_UWP
catch (Exception)
#else
catch (HttpRequestException)
#endif
{
if (numRetries++ >= RetryCount)
throw;
Debug.LogWarning("Load failed, retrying");
await Task.Delay((int)(RetryTimeout * 1000));
Start();
}
}
19
Source : Utils.cs
with GNU General Public License v3.0
from Kingo64
with GNU General Public License v3.0
from Kingo64
public static void ApplyStandardMixer(AudioSource[] audioSource) {
if (audioSource != null) {
try {
var defaultAudioMixer = GameManager.local.audioMixer.FindMatchingGroups("Effect")[0];
foreach (var a in audioSource) a.outputAudioMixerGroup = defaultAudioMixer;
}
catch {
Debug.LogWarning("The Outer Rim: Couldn't find AudioMixerGroup 'Effect'.");
}
}
}
19
Source : RuntimeRequiredComponentUtility.cs
with MIT License
from lazlo-bonin
with MIT License
from lazlo-bonin
private static IEnumerable<Type> FetchRequiredComponentTypes(Type componentType)
{
if (!typeof(Component).IsreplacedignableFrom(componentType))
{
throw new ArgumentException("Component type is not derived from component.", nameof(componentType));
}
foreach (var type in ComponentTypeUtility.GetManagedComponentTypes(componentType))
{
foreach (var attribute in type.GetCustomAttributes(typeof(RuntimeRequireComponentAttribute), true).Cast<RuntimeRequireComponentAttribute>())
{
var requiredComponentType = attribute.componentType;
if (!typeof(Component).IsreplacedignableFrom(requiredComponentType))
{
Debug.LogWarning($"Required component type '{requiredComponentType}' is not derived from component, ignoring.");
continue;
}
yield return requiredComponentType;
}
}
}
19
Source : StaticLuaCallbacks.cs
with Apache License 2.0
from leinlin
with Apache License 2.0
from leinlin
[MonoPInvokeCallback(typeof(LuaCSFunction))]
internal static int LoadFromStreamingreplacedetsPath(RealStatePtr L)
{
try
{
string filename = LuaAPI.lua_tostring(L, 1).Replace('.', '/') + ".lua";
var filepath = UnityEngine.Application.streamingreplacedetsPath + "/" + filename;
#if UNITY_ANDROID && !UNITY_EDITOR
UnityEngine.WWW www = new UnityEngine.WWW(filepath);
while (true)
{
if (www.isDone || !string.IsNullOrEmpty(www.error))
{
System.Threading.Thread.Sleep(50); //�Ƚ�hacker������
if (!string.IsNullOrEmpty(www.error))
{
LuaAPI.lua_pushstring(L, string.Format(
"\n\tno such file '{0}' in streamingreplacedetsPath!", filename));
}
else
{
UnityEngine.Debug.LogWarning("load lua file from Streamingreplacedets is obsolete, filename:" + filename);
if (LuaAPI.xluaL_loadbuffer(L, www.bytes, www.bytes.Length , "@" + filename) != 0)
{
return LuaAPI.luaL_error(L, String.Format("error loading module {0} from streamingreplacedetsPath, {1}",
LuaAPI.lua_tostring(L, 1), LuaAPI.lua_tostring(L, -1)));
}
}
break;
}
}
#else
if (File.Exists(filepath))
{
// string text = File.ReadAllText(filepath);
var bytes = File.ReadAllBytes(filepath);
UnityEngine.Debug.LogWarning("load lua file from Streamingreplacedets is obsolete, filename:" + filename);
if (LuaAPI.xluaL_loadbuffer(L, bytes, bytes.Length, "@" + filename) != 0)
{
return LuaAPI.luaL_error(L, String.Format("error loading module {0} from streamingreplacedetsPath, {1}",
LuaAPI.lua_tostring(L, 1), LuaAPI.lua_tostring(L, -1)));
}
}
else
{
LuaAPI.lua_pushstring(L, string.Format(
"\n\tno such file '{0}' in streamingreplacedetsPath!", filename));
}
#endif
return 1;
}
catch (System.Exception e)
{
return LuaAPI.luaL_error(L, "c# exception in LoadFromStreamingreplacedetsPath:" + e);
}
}
19
Source : CurveEditor.cs
with MIT License
from liangxiegame
with MIT License
from liangxiegame
public void Add(SerializedProperty curve, CurveState state)
{
// Make sure the property is in fact an AnimationCurve
var animCurve = curve.animationCurveValue;
if (animCurve == null)
throw new ArgumentException("curve");
if (m_Curves.ContainsKey(curve))
Debug.LogWarning("Curve has already been added to the editor");
m_Curves.Add(curve, state);
}
19
Source : TimerManager.cs
with MIT License
from liangxiegame
with MIT License
from liangxiegame
private void Pause()
{
if (_isFinish)
{
if (showLog) Debug.LogWarning("【TimerTrigger(容错)】:计时已经结束!");
}
else
{
_isPause = true;
}
}
19
Source : TimerManager.cs
with MIT License
from liangxiegame
with MIT License
from liangxiegame
public Timer SetTime(float endTime)
{
if (_isFinish)
{
if (showLog) Debug.LogWarning("【TimerTrigger(容错)】:计时已经结束!");
}
else
{
if (endTime == _time)
{
if (showLog) Debug.Log("【TimerTrigger(容错)】:时间已被设置,请勿重复操作!");
}
else
{
if (endTime < 0)
{
if (showLog) Debug.Log("【TimerTrigger(容错)】:时间不支持负数,已自动取正!");
endTime = Mathf.Abs(endTime);
}
if (endTime < timePreplaceded)//如果用户设置时间已错失
{
if (showLog) Debug.Log(string.Format("【TimerTrigger(容错)】:时间设置过短【preplaceded:set=>{0}:{1}】,事件提前触发!", timePreplaceded, endTime));
}
_time = endTime;
}
}
return this;
}
19
Source : TimerManager.cs
with MIT License
from liangxiegame
with MIT License
from liangxiegame
private void Resum()
{
if (_isFinish)
{
if (showLog) Debug.LogWarning("【TimerTrigger(容错)】:计时已经结束!");
}
else
{
if (_isPause)
{
cachedTime = CurrentTime - timePreplaceded;
_isPause = false;
}
else
{
if (showLog) Debug.LogWarning("【TimerTrigger(容错)】:计时并未处于暂停状态!");
}
}
}
19
Source : AssetDataGroup.cs
with MIT License
from liangxiegame
with MIT License
from liangxiegame
public bool AddreplacedetData(replacedetData data)
{
if (mreplacedetDataMap == null)
{
mreplacedetDataMap = new Dictionary<string, replacedetData>();
}
if (mUUID4replacedetData == null)
{
mUUID4replacedetData = new Dictionary<string, replacedetData>();
}
string key = data.replacedetName.ToLower();
if (mreplacedetDataMap.ContainsKey(key))
{
var resSearchRule = ResSearchRule.Allocate(data.replacedetName);
var old = GetreplacedetData(resSearchRule);
resSearchRule.Recycle2Cache();
try
{
Log.E("Already Add replacedetData :{0} \n OldAB:{1} NewAB:{2}", data.replacedetName,
mABUnitArray[old.replacedetBundleIndex].abName, mABUnitArray[data.replacedetBundleIndex].abName);
}
catch (Exception e)
{
Debug.LogWarning(e);
}
}
else
{
mreplacedetDataMap.Add(key, data);
}
if (mUUID4replacedetData.ContainsKey(data.UUID))
{
var resSearchRule = ResSearchRule.Allocate(data.replacedetName, data.OwnerBundleName);
replacedetData old = GetreplacedetData(resSearchRule);
resSearchRule.Recycle2Cache();
Log.E("Already Add replacedetData :{0} \n OldAB:{1} NewAB:{2}", data.UUID,
mABUnitArray[old.replacedetBundleIndex].abName, mABUnitArray[data.replacedetBundleIndex].abName);
}
else
{
mUUID4replacedetData.Add(data.UUID,data);
}
return true;
}
19
Source : PixelKit.cs
with MIT License
from liangxiegame
with MIT License
from liangxiegame
void LoadSelectedImage()
{
if (selectedTexture==null) return;
Undo.RecordObject(canvas, "Load image");
// check if its readable, if not set it temporarily readable
bool setReadable = false;
string path = replacedetDatabase.GetreplacedetPath(selectedTexture);
TextureImporter textureImporter = replacedetImporter.GetAtPath(path) as TextureImporter;
if (textureImporter.isReadable == false)
{
textureImporter.isReadable = true;
replacedetDatabase.Importreplacedet(path, ImportreplacedetOptions.ForceUpdate);
setReadable = true;
}
// if same size, just load in
if (selectedTexture.width == imageSize || selectedTexture.height == imageSize)
{
canvas.SetPixels(selectedTexture.GetPixels());
}else{ // wrong size, TODO: ask to resize canvas OR image
Debug.LogWarning(appName+": Scaling will happen. Because canvas size="+imageSize+"x"+imageSize+", Loading texture="+selectedTexture.width+"x"+selectedTexture.height);
float xs=selectedTexture.width/(float)canvas.width;
float ys=selectedTexture.height/(float)canvas.height;
float sx=0;
float sy=0;
for(int x = 0; x < canvas.width; x++)
{
sy=0;
for(int y = 0; y < canvas.height; y++)
{
canvas.SetPixel(x,y,selectedTexture.GetPixel((int)sx,(int)sy));
sy+=ys;
}
sx+=xs;
}
}
canvas.Apply(false);
// restore isReadable setting, if we had changed it
if (setReadable)
{
textureImporter.isReadable = false;
replacedetDatabase.Importreplacedet(path, ImportreplacedetOptions.ForceUpdate);
setReadable = false;
}
replacedetDatabase.Importreplacedet(path, ImportreplacedetOptions.ForceUpdate);
needsUpdate=true;
if (automaticOutline) DrawOutline();
}
19
Source : UPASession.cs
with MIT License
from liangxiegame
with MIT License
from liangxiegame
public static UPAImage OpenImageByreplacedet (UPAImage img) {
if (img == null) {
Debug.LogWarning ("Image is null. Returning null.");
EditorPrefs.SetString ("currentImgPath", "");
return null;
}
string path = replacedetDatabase.GetreplacedetPath (img);
EditorPrefs.SetString ("currentImgPath", path);
return img;
}
19
Source : TypeDrawer.cs
with MIT License
from LunariStudios
with MIT License
from LunariStudios
public override void Draw(CutsceneEditor editor, CutscenePlayer player, Cutscene cutscene, Rect rect, int tokenIndex, GUIContent name, object value, Type valueType, FieldInfo fieldInfo, Setter setter) {
T finalV;
if (value == null || value is T) {
finalV = (T) value;
} else {
var msg = string.Format("[{2}] Expected an object of type {0} but got {1}! Using default value...",
supportedType, value, GetType().Name);
Debug.LogWarning(msg);
finalV = default(T);
}
Draw(editor, player, cutscene, rect, tokenIndex, name, finalV, valueType, fieldInfo, setter);
}
19
Source : CutsceneTrigger.cs
with MIT License
from LunariStudios
with MIT License
from LunariStudios
protected void Trigger() {
if (!Player) {
Debug.LogWarning("[ShiroiCutscenes] Couldn't find an active instance of CutscenePlayer!");
return;
}
if (PostAction != PostPlayAction.None && played) {
return;
}
played = true;
Player.Play(Cutscene);
switch (PostAction) {
case PostPlayAction.None:
break;
case PostPlayAction.Disable:
enabled = false;
break;
case PostPlayAction.DestroyGameObject:
Destroy(gameObject);
break;
case PostPlayAction.DestroySelf:
Destroy(this);
break;
default:
throw new ArgumentOutOfRangeException();
}
}
19
Source : Entity.cs
with MIT License
from LunariStudios
with MIT License
from LunariStudios
private void Awake() {
Aware = true;
var found = GetComponentsInChildren<Trait>();
foreach (var trait in found) {
if (traits.HasTrait(found.GetType())) {
Debug.LogWarning(
$"Enreplacedy '{this}' has multiple traits of type '{trait.GetType()}', please remove one of the traits before building for Release"
);
continue;
}
if (!trait.TryClaim(this, found, out var dependencies)) {
Debug.LogWarning(
$"Unable to claim trait {trait}: {dependencies.FailureReason}"
);
continue;
}
traits.Include(trait);
}
}
19
Source : UnityLogger.cs
with MIT License
from LunariStudios
with MIT License
from LunariStudios
public void LogWarning(string warning) {
Debug.LogWarning(FormatMessage(warning));
}
19
Source : UnityLogger.cs
with MIT License
from LunariStudios
with MIT License
from LunariStudios
public void LogError(string error) {
Debug.LogWarning(FormatMessage(error));
}
19
Source : EquipItems.cs
with MIT License
from mamoniem
with MIT License
from mamoniem
void Start ()
{
if (itemIDs != null && itemIDs.Length > 0)
{
InvEquipment eq = GetComponent<InvEquipment>();
if (eq == null) eq = gameObject.AddComponent<InvEquipment>();
int qualityLevels = (int)InvGameItem.Quality._LastDoNotUse;
for (int i = 0, imax = itemIDs.Length; i < imax; ++i)
{
int index = itemIDs[i];
InvBaseItem item = InvDatabase.FindByID(index);
if (item != null)
{
InvGameItem gi = new InvGameItem(index, item);
gi.quality = (InvGameItem.Quality)Random.Range(0, qualityLevels);
gi.itemLevel = NGUITools.RandomRange(item.minItemLevel, item.maxItemLevel);
eq.Equip(gi);
}
else
{
Debug.LogWarning("Can't resolve the item ID of " + index);
}
}
}
Destroy(this);
}
19
Source : NGUIJson.cs
with MIT License
from mamoniem
with MIT License
from mamoniem
static public void LoadSpriteData (UIAtlas atlas, Textreplacedet replacedet)
{
if (replacedet == null || atlas == null) return;
string jsonString = replacedet.text;
Hashtable decodedHash = jsonDecode(jsonString) as Hashtable;
if (decodedHash == null)
{
Debug.LogWarning("Unable to parse Json file: " + replacedet.name);
}
else LoadSpriteData(atlas, decodedHash);
replacedet = null;
Resources.UnloadUnusedreplacedets();
}
19
Source : NGUIJson.cs
with MIT License
from mamoniem
with MIT License
from mamoniem
static public void LoadSpriteData (UIAtlas atlas, string jsonData)
{
if (string.IsNullOrEmpty(jsonData) || atlas == null) return;
Hashtable decodedHash = jsonDecode(jsonData) as Hashtable;
if (decodedHash == null)
{
Debug.LogWarning("Unable to parse the provided Json string");
}
else LoadSpriteData(atlas, decodedHash);
}
19
Source : UIDrawCallInspector.cs
with MIT License
from mamoniem
with MIT License
from mamoniem
public override void OnInspectorGUI ()
{
if (Event.current.type == EventType.Repaint || Event.current.type == EventType.Layout)
{
UIDrawCall dc = target as UIDrawCall;
if (dc.manager != null)
{
EditorGUILayout.LabelField("Render Queue", dc.renderQueue.ToString());
EditorGUILayout.LabelField("Owner Panel", NGUITools.GetHierarchy(dc.manager.gameObject));
EditorGUILayout.LabelField("Triangles", dc.triangles.ToString());
}
else if (Event.current.type == EventType.Repaint)
{
Debug.LogWarning("Orphaned UIDrawCall detected!\nUse [Selection -> Force Delete] to get rid of it.");
}
}
}
19
Source : NGUISelectionTools.cs
with MIT License
from mamoniem
with MIT License
from mamoniem
static bool HasValidSelection()
{
if (Selection.objects == null || Selection.objects.Length == 0)
{
Debug.LogWarning("You must select an object first");
return false;
}
return true;
}
19
Source : NGUISelectionTools.cs
with MIT License
from mamoniem
with MIT License
from mamoniem
static bool HasValidTransform()
{
if (Selection.activeTransform == null)
{
Debug.LogWarning("You must select an object first");
return false;
}
return true;
}
19
Source : EventDelegate.cs
with MIT License
from mamoniem
with MIT License
from mamoniem
static public EventDelegate Add (List<EventDelegate> list, Callback callback, bool oneShot)
{
if (list != null)
{
for (int i = 0, imax = list.Count; i < imax; ++i)
{
EventDelegate del = list[i];
if (del != null && del.Equals(callback))
return del;
}
EventDelegate ed = new EventDelegate(callback);
ed.oneShot = oneShot;
list.Add(ed);
return ed;
}
Debug.LogWarning("Attempting to add a callback to a list that's null");
return null;
}
19
Source : EventDelegate.cs
with MIT License
from mamoniem
with MIT License
from mamoniem
static public void Add (List<EventDelegate> list, EventDelegate ev, bool oneShot)
{
if (ev.mRawDelegate || ev.target == null || string.IsNullOrEmpty(ev.methodName))
{
Add(list, ev.mCachedCallback, oneShot);
}
else if (list != null)
{
for (int i = 0, imax = list.Count; i < imax; ++i)
{
EventDelegate del = list[i];
if (del != null && del.Equals(ev))
return;
}
EventDelegate copy = new EventDelegate(ev.target, ev.methodName);
copy.oneShot = oneShot;
if (ev.mParameters != null && ev.mParameters.Length > 0)
{
copy.mParameters = new Parameter[ev.mParameters.Length];
for (int i = 0; i < ev.mParameters.Length; ++i)
copy.mParameters[i] = ev.mParameters[i];
}
list.Add(copy);
}
else Debug.LogWarning("Attempting to add a callback to a list that's null");
}
19
Source : Localization.cs
with MIT License
from mamoniem
with MIT License
from mamoniem
static void AddCSV (BetterList<string> values, bool warnOnDuplicate = true)
{
if (values.size < 2) return;
string key = values[0];
if (string.IsNullOrEmpty(key)) return;
string[] temp = new string[values.size - 1];
for (int i = 1; i < values.size; ++i) temp[i - 1] = values[i];
if (mDictionary.ContainsKey(key))
{
mDictionary[key] = temp;
if (warnOnDuplicate) Debug.LogWarning("Localization key '" + key + "' is already present");
}
else
{
try
{
mDictionary.Add(key, temp);
}
catch (System.Exception ex)
{
Debug.LogError("Unable to add '" + key + "' to the Localization dictionary.\n" + ex.Message);
}
}
}
19
Source : NGUIMath.cs
with MIT License
from mamoniem
with MIT License
from mamoniem
static public Vector2 ScreenToPixels (Vector2 pos, Transform relativeTo)
{
int layer = relativeTo.gameObject.layer;
Camera cam = NGUITools.FindCameraForLayer(layer);
if (cam == null)
{
Debug.LogWarning("No camera found for layer " + layer);
return pos;
}
Vector3 wp = cam.ScreenToWorldPoint(pos);
return relativeTo.InverseTransformPoint(wp);
}
19
Source : NGUIMath.cs
with MIT License
from mamoniem
with MIT License
from mamoniem
static public Vector2 ScreenToParentPixels (Vector2 pos, Transform relativeTo)
{
int layer = relativeTo.gameObject.layer;
if (relativeTo.parent != null)
relativeTo = relativeTo.parent;
Camera cam = NGUITools.FindCameraForLayer(layer);
if (cam == null)
{
Debug.LogWarning("No camera found for layer " + layer);
return pos;
}
Vector3 wp = cam.ScreenToWorldPoint(pos);
return (relativeTo != null) ? relativeTo.InverseTransformPoint(wp) : wp;
}
19
Source : WheelEffects.cs
with GNU General Public License v2.0
from marssociety
with GNU General Public License v2.0
from marssociety
private void Start()
{
skidParticles = transform.root.GetComponentInChildren<ParticleSystem>();
if (skidParticles == null)
{
Debug.LogWarning(" no particle system found on car to generate smoke particles");
}
else
{
skidParticles.Stop();
}
m_WheelCollider = GetComponent<WheelCollider>();
m_AudioSource = GetComponent<AudioSource>();
PlayingAudio = false;
if (skidTrailsDetachedParent == null)
{
skidTrailsDetachedParent = new GameObject("Skid Trails - Detached").transform;
}
}
19
Source : UnityLogger.cs
with MIT License
from microsoft
with MIT License
from microsoft
public new void LogError(string message)
{
Debug.LogWarning($"WARNING: {message}");
Send(TraceSeverity.Error, message);
}
See More Examples